Re: Create or replace row in table

Поиск
Список
Период
Сортировка
От Mladen Gogala
Тема Re: Create or replace row in table
Дата
Msg-id 4C7F1FD0.2040507@vmsinfo.com
обсуждение исходный текст
Ответ на Create or replace row in table  ("Charles Holleran " <scorpdaddy@hotmail.com>)
Список pgsql-novice
Charles Holleran wrote:
> Please pardon the total nubie question.
>
> There is a nice syntax for functions,  "CREATE OR REPLACE FUNCTION xyz ..."
>
> What is the best syntax to create or replace a row in a table?
>
> Specifically: Update row in table t if row exists in table t else insert row in table t with source rows from
temporarytable s of same type as t. 

INSERT or UPDATE should do the trick, especially when combined with
plpgsql, exceptions and basic error handling. You should be able to find
the relevant material here:
http://developer.postgresql.org/pgdocs/postgres/plpgsql-control-structures.html
and here:
http://developer.postgresql.org/pgdocs/postgres/errcodes-appendix.html

--
Mladen Gogala
Sr. Oracle DBA
1500 Broadway
New York, NY 10036
(212) 329-5251
www.vmsinfo.com


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

Предыдущее
От: "Charles Holleran "
Дата:
Сообщение: Create or replace row in table
Следующее
От: A B
Дата:
Сообщение: operator @> does not work with box.