Re: INSERT Return Value? - Mailing list pgsql-novice

From Jaime Casanova
Subject Re: INSERT Return Value?
Date
Msg-id c2d9e70e0701032151x425064c3g9a954f8157d9f6b6@mail.gmail.com
Whole thread Raw
In response to INSERT Return Value?  (Greg Lindstrom <greg.lindstrom@novasyshealth.com>)
List 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 by date:

Previous
From: Tom Lane
Date:
Subject: Re: Excess idle processes, leaking WAL logs?
Next
From: "ajmaske"
Date:
Subject: Storing Images