Re: [GENERAL] Transactions and ID's generated by triggers

2011-02-28 Thread Alban Hertroys
On 28 Feb 2011, at 22:07, Andre Lopes wrote: > Hi, > > Thanks for the reply. > > How can I user the RETURNING without pl/sql? My PostgreSQL version is 8.3 > > Can you give me some example? http://www.postgresql.org/docs/8.3/interactive/sql-insert.html Most notably the last example on that pag

Re: [GENERAL] Transactions and ID's generated by triggers

2011-02-28 Thread Andre Lopes
Hi, Thanks for the reply. How can I user the RETURNING without pl/sql? My PostgreSQL version is 8.3 Can you give me some example? Best Regards, On Mon, Feb 28, 2011 at 7:00 PM, Alban Hertroys wrote: > On 28 Feb 2011, at 24:37, David Johnston wrote: > >> Using pl/pgsql you can: > > You don'

Re: [GENERAL] Transactions and ID's generated by triggers

2011-02-28 Thread Alban Hertroys
On 28 Feb 2011, at 24:37, David Johnston wrote: > Using pl/pgsql you can: You don't need pl/pgsql for that. You can return the resultset of the first insert into a client-side variable (while still making use of the RETURNING-clause of course). Of course, the benefit of using pl/pgsql for this

Re: [GENERAL] Transactions and ID's generated by triggers

2011-02-28 Thread Andre Lopes
Thanks for the reply. I will try the code tonight. Best Regards, On Sun, Feb 27, 2011 at 11:37 PM, David Johnston wrote: > Using pl/pgsql you can: > > DECLARE idordinal type; > BEGIN > INSERT INTO tdir_uris_files RETURNING id_ordinal INTO idordinal; > INSERT INTO tdir_uris_files_details

Re: [GENERAL] Transactions and ID's generated by triggers

2011-02-27 Thread David Johnston
Using pl/pgsql you can: DECLARE idordinal type; BEGIN INSERT INTO tdir_uris_files RETURNING id_ordinal INTO idordinal; INSERT INTO tdir_uris_files_details (id_ordinal) VALUES (idordinal); END; Similar results are possible in other environments. If you do not have access to "RETURNING"