BUG #2749: Function's final statement must be a SELECT

Started by Hagenover 19 years ago2 messagesbugs
Jump to latest
#1Hagen
sixtus@gmail.com

The following bug has been logged online:

Bug reference: 2749
Logged by: Hagen
Email address: sixtus@gmail.com
PostgreSQL version: 8.2beta2
Operating system: OSX
Description: Function's final statement must be a SELECT
Details:

create function test(text) returns table as $sql$
insert into table(value) values($1) returning *;
$sql$ language sql;

really should work now, instead I get:
PGError: ERROR: return type mismatch in function declared to return table
DETAIL: Function's final statement must be a SELECT.

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Hagen (#1)
Re: BUG #2749: Function's final statement must be a SELECT

"Hagen" <sixtus@gmail.com> writes:

create function test(text) returns table as $sql$
insert into table(value) values($1) returning *;
$sql$ language sql;

really should work now,

No doubt, but it's not happening for 8.2. See thread here:
http://archives.postgresql.org/pgsql-hackers/2006-10/msg00665.php
There's a lot more to it than meets the eye :-(

regards, tom lane