Re: Example of RETURNING clause to get auto-generated keys

Поиск
Список
Период
Сортировка
От John D. Burger
Тема Re: Example of RETURNING clause to get auto-generated keys
Дата
Msg-id 6268334A-22A3-4EFA-96B8-E5484B70591F@mitre.org
обсуждение исходный текст
Ответ на Re: Example of RETURNING clause to get auto-generated keys  (Ken Johanson <pg-user@kensystem.com>)
Список pgsql-general
Ken Johanson wrote:

> Just to be sure, will the RETURNING clause work with custom
> sequences (say, non numeric or increment by two) or other types of
> key generators?... And how will triggers interfere with it (if at
> all)?

RETURNING has nothing to do with sequences per se - it's just a way
of getting at any of the columns of the new row, regardless of how
they got filled.
> The optional RETURNING clause causes INSERT to compute and return
> value(s) based on each row actually inserted. This is primarily
> useful for obtaining values that were supplied by defaults, such as
> a serial sequence number. However, any expression using the table's
> columns is allowed. The syntax of the RETURNING list is identical
> to that of the output list of SELECT.
http://www.postgresql.org/docs/8.2/interactive/sql-insert.html

- John Burger
   MITRE

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

Предыдущее
От: "Merlin Moncure"
Дата:
Сообщение: Re: Idle in transaction - Explination ..
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: Example of RETURNING clause to get auto-generated keys