Re: Error Trapping -duplicate keys - Mailing list pgsql-novice

From Tom Lane
Subject Re: Error Trapping -duplicate keys
Date
Msg-id 12590.1025617510@sss.pgh.pa.us
Whole thread Raw
In response to Re: Error Trapping -duplicate keys  (Ludwig Lim <lud_nowhere_man@yahoo.com>)
List pgsql-novice
Ludwig Lim <lud_nowhere_man@yahoo.com> writes:
>   if count is zero insert else update.

Alternatively, try updating first, and if you see zero rows updated
then insert.  Which one will be faster depends on whether you expect
insert or update to be the typical case.

            regards, tom lane



pgsql-novice by date:

Previous
From: Ludwig Lim
Date:
Subject: Re: Error Trapping -duplicate keys
Next
From: Karin Nila Huegele
Date:
Subject: how to view table foreign keys/triggers?