From: | "Jaime Casanova" <systemguards(at)gmail(dot)com> |
---|---|
To: | "Greg Lindstrom" <greg(dot)lindstrom(at)novasyshealth(dot)com> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: INSERT Return Value? |
Date: | 2007-01-04 05:51:36 |
Message-ID: | c2d9e70e0701032151x425064c3g9a954f8157d9f6b6@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
On 12/11/06, Greg Lindstrom <greg(dot)lindstrom(at)novasyshealth(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | ajmaske | 2007-01-04 09:50:35 | Storing Images |
Previous Message | Tom Lane | 2007-01-03 23:13:27 | Re: Excess idle processes, leaking WAL logs? |