Re: mysql replace in postgreSQL?

Поиск
Список
Период
Сортировка
От
Тема Re: mysql replace in postgreSQL?
Дата
Msg-id A7lGXMqe.1130656473.8695620.cristian@clickdiario.com
обсуждение исходный текст
Ответ на mysql replace in postgreSQL?  (blackwater dev <blackwaterdev@gmail.com>)
Список pgsql-general
On 10/29/2005, "blackwater dev" <blackwaterdev@gmail.com> wrote:

>In MySQL, I can use the replace statement which either updates the
>data there or inserts it.  Is there a comporable syntax to use in
>postgreSQL?
>
>I need to do an insert and don't want to have to worry about if the
>data is already there or not...so don't want to see if it there, if so
>do update if not insert...etc.
>
>Thanks.
>
>---------------------------(end of broadcast)---------------------------
>TIP 6: explain analyze is your friend

BEGIN;
-- other operations
SAVEPOINT sp1;
INSERT INTO wines VALUES('Chateau Lafite 2003', '24');
-- Assume the above fails because of a unique key violation,
-- so now we issue these commands:
ROLLBACK TO sp1;
UPDATE wines SET stock = stock + 24 WHERE winename = 'Chateau Lafite
2003';
-- continue with other operations, and eventually
COMMIT;

(extracted from the PostgreSQL Manual -
http://www.postgresql.org/docs/8.0/interactive/sql-update.html -)

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

Предыдущее
От: Matthew Peter
Дата:
Сообщение: function example?
Следующее
От: "A. Kretschmer"
Дата:
Сообщение: Re: function example?