Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save StevenMMortimer/35d69ec4a7510917c994 to your computer and use it in GitHub Desktop.
Save StevenMMortimer/35d69ec4a7510917c994 to your computer and use it in GitHub Desktop.
-- create a rule that will ignore dupe inserts
-- this is done on a table-by-table basis
CREATE OR REPLACE RULE db_table_ignore_duplicate_inserts AS
ON INSERT TO schema.table
WHERE EXISTS (
SELECT 1
FROM schema.table
WHERE id = NEW.id
)
DO INSTEAD NOTHING;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment