Re: INSERT Return Value?

Поиск
Список
Период
Сортировка
От Jaime Casanova
Тема Re: INSERT Return Value?
Дата
Msg-id c2d9e70e0701032151x425064c3g9a954f8157d9f6b6@mail.gmail.com
обсуждение исходный текст
Ответ на INSERT Return Value?  (Greg Lindstrom <greg.lindstrom@novasyshealth.com>)
Список pgsql-novice
On 12/11/06, Greg Lindstrom <greg.lindstrom@novasyshealth.com> wrote:
> Hello-
>
> I am running Postgres 8.08 on a Linux system.  When I insert data into a
> table I generate and store a value in the table via a trigger that fires
> after the insert.  Is there a way to retrieve the value that I generate
> with the trigger?  In this case, I am generating a broker number and
> would like to get it back.  One method would be to grab the sequence
> number of the record and then make another query, but I feel there is a
> more elegant way to get the field.
>

you can migrate to 8.2 and use the new INSERT | UPDATE | DELETE
returning feature

http://www.postgresql.org/docs/8.2/static/sql-insert.html
http://www.postgresql.org/docs/8.2/static/sql-update.html
http://www.postgresql.org/docs/8.2/static/sql-delete.html

--
regards,
Jaime Casanova

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs and the universe trying
to produce bigger and better idiots.
So far, the universe is winning."
                                       Richard Cook

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Excess idle processes, leaking WAL logs?
Следующее
От: "ajmaske"
Дата:
Сообщение: Storing Images