Re: Insert Or update

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: Insert Or update
Дата
Msg-id 20040423150334.GA6904@wolff.to
обсуждение исходный текст
Ответ на Insert Or update  (Anton Nikiforov <anton@nikiforov.ru>)
Ответы Re: Insert Or update  (Greg Stark <gsstark@mit.edu>)
Список pgsql-general
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.

В списке pgsql-general по дате отправления:

Предыдущее
От: "Bas Scheffers"
Дата:
Сообщение: Re: Insert Or update
Следующее
От: Pascal Polleunus
Дата:
Сообщение: Synchronize unicode data using copy or pg_dump