On Jan 11, 2008 4:23 AM, Daniel Caune <daniel.caune@ubisoft.com> wrote:
> Hi,
>
> Is there any way to define a SQL stored function that inserts a row in a
> table and returns the serial generated?
Maybe you just need INSERT ... RETURNING?
http://www.postgresql.org/docs/8.2/interactive/sql-insert.html
" Insert a single row into table distributors, returning the sequence
number generated by the DEFAULT clause:
INSERT INTO distributors (did, dname) VALUES (DEFAULT, 'XYZ Widgets') RETURNING did;
"