Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE OR REPLACE FUNCTION cleanNoteEventConnections() RETURNS TRIGGER AS $$
- DECLARE
- BEGIN
- EXECUTE 'update invoice set "noteEvent"=null where "noteEvent"=' || OLD.id;
- RETURN NULL;
- END;
- $$ LANGUAGE 'plpgsql';
- CREATE TRIGGER cleanNoteEventConnections BEFORE DELETE ON note_event FOR EACH ROW EXECUTE PROCEDURE cleanNoteEventConnections();
- delete from note_event where id=34
- result: Query returned successfully: 0 rows affected, 11 msec execution time.
Add Comment
Please, Sign In to add comment