Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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;

pgsql-bugs by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group