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

Re: BUG #6336: SQL stored procedure returing 'int' calling into SRF does not raise error ...

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: <pgsql-bugs(at)postgresql(dot)org>,<jlrobins(at)socialserve(dot)com>
Subject: Re: BUG #6336: SQL stored procedure returing 'int' calling into SRF does not raise error ...
Date: 2011-12-15 01:47:46
Message-ID: 4EE8FD630200002500043CCD@gw.wicourts.gov (view raw or flat)
Thread:
Lists: pgsql-bugs
wrote:
 
> calling into generate_series() within a 'returns int' (singular)
> SQL stored function doesn't raise error (plpgsql does):
> 
> -- SQL function elides over fact that generate_series() is a SRF
> create function foo_sql()
> returns int as
> $$
> select * from generate_series(1,5)
> $$ language sql stable;
> 
> select foo_sql();
> 
> /*
> 
> whoa --- returns, and just one int.
> foo
> -----
> 1
> */
 
This is functioning as designed and documented.  The first two
sentences of the documentation of SQL functions are:
 
| SQL functions execute an arbitrary list of SQL statements,
| returning the result of the last query in the list. In the simple
| (non-set) case, the first row of the last query's result will be
| returned.
 
http://www.postgresql.org/docs/9.1/interactive/xfunc-sql.html
 
-Kevin

pgsql-bugs by date

Next:From: Tom LaneDate: 2011-12-15 08:11:44
Subject: Re: BUG #6335: Weird planner decision with exists (a join b) condition
Previous:From: Maxim BogukDate: 2011-12-15 01:28:13
Subject: Re: BUG #6335: Weird planner decision with exists (a join b) condition

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