Search Postgresql Archives

Re: Insert Or update

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 23, 2004 at 17:48:21 +0400,
  Anton Nikiforov <anton@nikiforov.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.

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to majordomo@postgresql.org so that your
      message can get through to the mailing list cleanly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux