pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: jlrobins@socialserve.com
To: pgsql-bugs@postgresql.org
Subject: BUG #6336: SQL stored procedure returing 'int' calling into SRF does not raise error ...
Date: Wed, 14 Dec 2011 19:06:09 +0000
Message-ID: <E1Rau9Z-0005oR-Lc@wrigleys.postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      6336
Logged by:          James Robinson
Email address:      jlrobins@socialserve.com
PostgreSQL version: 9.1.2
Operating system:   OSX
Description:        

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
*/


create function foo_plpgsql()
returns int as
$$
declare
  retvar int;
begin
  retvar := generate_series(1,5);
  return retvar;
end;
$$ language plpgsql stable;

-- properly fails --- ERROR:  query "SELECT generate_series(1,5)" returned
more than one row
select foo_plpgsql();





view thread (2+ messages)  latest in thread

Message-ID: <E1Rau9Z-0005oR-Lc@wrigleys.postgresql.org>
Permalink:  ../E1Rau9Z-0005oR-Lc@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/E1Rau9Z-0005oR-Lc@wrigleys.postgresql.org

 · 

reply

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: jlrobins@socialserve.com
  Subject: Re: BUG #6336: SQL stored procedure returing 'int' calling into SRF does not raise error ...
  In-Reply-To: <E1Rau9Z-0005oR-Lc@wrigleys.postgresql.org>
  References: <E1Rau9Z-0005oR-Lc@wrigleys.postgresql.org>

* 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