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

BUG #6336: SQL stored procedure returing 'int' calling into SRF doesnot 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 doesnot raise error ...
Date: 2011-12-14 19:06:09
Message-ID: E1Rau9Z-0005oR-Lc@wrigleys.postgresql.org (view raw or flat)
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();



pgsql-bugs by date

Next:From: Alvaro HerreraDate: 2011-12-14 22:06:23
Subject: Re: BUG #6334: initdb not working
Previous:From: Alvaro HerreraDate: 2011-12-14 14:00:16
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