Search Postgresql Archives

Re: INSERT with RETURNING clause inside SQL function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Diego Schulz" <dschulz@xxxxxxxxx> writes:
> I expected something like this to work, but it doesn't:

> CREATE OR REPLACE FUNCTION add_something(text, text) RETURNS INTEGER AS $$
>    INSERT INTO sometable (id, foo, bar ) VALUES (DEFAULT, $1, $2 )
> RETURNING id ;
> $$ LANGUAGE SQL ;

This case was implemented last week.  In existing release branches
you'll need to use currval or some other workaround to collect the
serial value.

			regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux