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

From: jlrobins(at)socialserve(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #6336: SQL stored procedure returing 'int' calling into SRF does not raise error ...
Date: 2011-12-14 19:06:09
Message-ID: E1Rau9Z-0005oR-Lc@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 6336
Logged by: James Robinson
Email address: jlrobins(at)socialserve(dot)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();

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2011-12-14 22:06:23 Re: BUG #6334: initdb not working
Previous Message Alvaro Herrera 2011-12-14 14:00:16 Re: BUG #6335: Weird planner decision with exists (a join b) condition