Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Created March 26, 2014 14:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/9784814 to your computer and use it in GitHub Desktop.
Save anonymous/9784814 to your computer and use it in GitHub Desktop.
CREATE LANGUAGE plpgsql;
CREATE FUNCTION myinsert() RETURNS trigger AS $$
BEGIN
IF NEW.name <> 'DUMMY' THEN
insert into names (name) values ('DUMMY');
END IF;
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER mytrig AFTER INSERT ON names
FOR EACH ROW
EXECUTE PROCEDURE myinsert();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment