Re: Implementing replace function

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема Re: Implementing replace function
Дата
Msg-id iajf5l$bpp$1@dough.gmane.org
обсуждение исходный текст
Ответ на Implementing replace function  (Alexander Farber <alexander.farber@gmail.com>)
Ответы Re: Implementing replace function  (Alexander Farber <alexander.farber@gmail.com>)
Re: Implementing replace function  (Matthieu Huin <matthieu.huin@wallix.com>)
Список pgsql-general
Alexander Farber wrote on 31.10.2010 09:22:
> Hello Postgres users,
>
> to mimic the MySQL-REPLACE statement I need
> to try to UPDATE a record and if that fails - INSERT it.
>

There is actually an example of this in the PG manual ;)

http://www.postgresql.org/docs/current/static/plpgsql-control-structures.html#PLPGSQL-UPSERT-EXAMPLE

Here is another solution based on triggers:
http://database-programmer.blogspot.com/2009/06/approaches-to-upsert.html

Regards
Thomas

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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: Implementing replace function
Следующее
От: Alexander Farber
Дата:
Сообщение: Re: Implementing replace function