Re: INSERT with RETURNING clause inside SQL function - Mailing list pgsql-general

From Tom Lane
Subject Re: INSERT with RETURNING clause inside SQL function
Date
Msg-id 2039.1225756262@sss.pgh.pa.us
Whole thread Raw
In response to INSERT with RETURNING clause inside SQL function  ("Diego Schulz" <dschulz@gmail.com>)
Responses Re: INSERT with RETURNING clause inside SQL function
List pgsql-general
"Diego Schulz" <dschulz@gmail.com> 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

pgsql-general by date:

Previous
From: Scott Ribe
Date:
Subject: Re: Are there plans to add data compression feature to postgresql?
Next
From: Jason Long
Date:
Subject: JDBC and setting statement_timeout