RETURNS TABLE returns NULL set when called by another RETURNS TABLE

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема RETURNS TABLE returns NULL set when called by another RETURNS TABLE
Дата
Msg-id 4B84856D.4080604@agliodbs.com
обсуждение исходный текст
Ответы Re: RETURNS TABLE returns NULL set when called by another RETURNS TABLE  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: RETURNS TABLE returns NULL set when called by another RETURNS TABLE  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-bugs
Pavel, all:

Apparently if you use one returns table function to call a 2nd returns
table function, it returns a recordset which consists entirely of nulls.

Here's the test case:

create table srf_data ( id serial, cat int, val text );
insert into srf_data ( cat, val ) values
( 1, 'josh' ),
( 1, 'selena' ),
( 2, 'bruce' ),
( 2, 'josh' ),
( 3, 'robert' );

create or replace  function srf1 ( this_cat int )
returns table (
        id1 int,
        val1 text )
language sql as $f$
select id, val from srf_data where cat = $1;
$f$;

create or replace function srf2 ( )
returns table (
        id1 int,
        val1 text )
language plpgsql as $f$
begin
return query
select id1, val1 from srf1(1);
return;
end;
$f$;

select * from srf2();

В списке pgsql-bugs по дате отправления:

Предыдущее
От: "Simon Ng"
Дата:
Сообщение: BUG #5344: pg_restore some foreign keys missing
Следующее
От: Tom Lane
Дата:
Сообщение: Re: RETURNS TABLE returns NULL set when called by another RETURNS TABLE