Re: Error Trapping -duplicate keys

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ludwig Lim <lud_nowhere_man(at)yahoo(dot)com>
Cc: "Steven D(dot) Smith" <sds07(at)health(dot)state(dot)ny(dot)us>, pgsql-novice(at)postgresql(dot)org
Subject: Re: Error Trapping -duplicate keys
Date: 2002-07-02 13:45:10
Message-ID: 12590.1025617510@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Ludwig Lim <lud_nowhere_man(at)yahoo(dot)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

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message robert kraus 2002-07-02 22:29:06 Importing complete txt file with column names
Previous Message Ludwig Lim 2002-07-02 12:00:21 Re: Error Trapping -duplicate keys