From: | Bruno Wolff III <bruno(at)wolff(dot)to> |
---|---|
To: | Anton Nikiforov <anton(at)nikiforov(dot)ru> |
Cc: | postgres list <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Insert Or update |
Date: | 2004-04-23 15:03:34 |
Message-ID: | 20040423150334.GA6904@wolff.to |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Fri, Apr 23, 2004 at 17:48:21 +0400,
Anton Nikiforov <anton(at)nikiforov(dot)ru> wrote:
> I know that this will be helpful to write a function that will do this
> for me, but it will run the same time as my insertion tool that is
> written in c or even slower. So my question is: is it possible to have
> "UPDATE OR INSERT" statement in the PostgreSQL like it is possible in
> Oracle (as i heard but did not check it by myself yet)?
This was discussed on the list over the last couple of days.
There is no update or insert statement in postgres.
You can do an update and check the number of rows affected and if it
is 0 do the insert.
However unless you lock the table while doing this, you have to be prepared
to handle errors.
From | Date | Subject | |
---|---|---|---|
Next Message | Pascal Polleunus | 2004-04-23 15:18:29 | Re: Synchronize unicode data using copy or pg_dump |
Previous Message | Bas Scheffers | 2004-04-23 14:53:03 | Re: Insert Or update |