From: Kevin Grittner <Kevin.Grittner@wicourts.gov>
To: pgsql-bugs@postgresql.org
To: jlrobins@socialserve.com
Subject: Re: BUG #6336: SQL stored procedure returing 'int' calling into SRF does not raise error ...
Date: Wed, 14 Dec 2011 19:47:46 -0600
Message-ID: <4EE8FD630200002500043CCD@gw.wicourts.gov> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: Kevin.Grittner@wicourts.gov, jlrobins@socialserve.com
Subject: Re: BUG #6336: SQL stored procedure returing 'int' calling into SRF does not raise error ...
In-Reply-To: <4EE8FD630200002500043CCD@gw.wicourts.gov>
References: <4EE8FD630200002500043CCD@gw.wicourts.gov>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox