Re: INSERT Trigger to check for existing records - Mailing list pgsql-general

From Michael Lewis
Subject Re: INSERT Trigger to check for existing records
Date
Msg-id CAHOFxGo9etLxf=ZmgNKfsZ1jnNo8OWcvx24520oQpqHo86BMYw@mail.gmail.com
Whole thread Raw
In response to RE: INSERT Trigger to check for existing records  (<hagen@datasundae.com>)
Responses Re: INSERT Trigger to check for existing records  (Hagen Finley <hagen@datasundae.com>)
List pgsql-general
If you can modify your insert statement, and live with an extra column in the data, no trigger is needed as best I can figure.

Create a unique index over the existing columns, add a "created_on" field and call insert on conflict (unique index) do nothing.

This should give the behavior you want.

pgsql-general by date:

Previous
From:
Date:
Subject: RE: INSERT Trigger to check for existing records
Next
From: Hagen Finley
Date:
Subject: Re: INSERT Trigger to check for existing records