BUG #3596: "insert ... returning *" not usable as last statement in a function...

From: "Ciprian Dorin Craciun" <ciprian(dot)craciun(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #3596: "insert ... returning *" not usable as last statement in a function...
Date: 2007-09-03 17:13:40
Message-ID: 200709031713.l83HDekd055443@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 3596
Logged by: Ciprian Dorin Craciun
Email address: ciprian(dot)craciun(at)gmail(dot)com
PostgreSQL version: 8.2.4
Operating system: Debian Etch (4.0)
Description: "insert ... returning *" not usable as last statement in
a function...
Details:

I think the best explanation is the example just above...

The idea is that in 8.2 insert statement was modified by adding an returning
option, that modifies insert to behave also as a select statement by
returning all the rows inserted. But unfortunately this option can not be
used inside functions that return something as a last statement...

create table table1 ( field int );

create function function1 ( int ) returns table1 as $$
insert into table1 values ($1) returning *;
$$ language sql;

Browse pgsql-bugs by date

  From Date Subject
Next Message Heikki Linnakangas 2007-09-03 18:06:22 Re: BUG #3595: Segmentation fault with a simple select query
Previous Message Jukka Holappa 2007-09-03 15:21:32 BUG #3595: Segmentation fault with a simple select query