Re: RETURNS TABLE returns NULL set when called by another RETURNS TABLE - Mailing list pgsql-bugs

From Tom Lane
Subject Re: RETURNS TABLE returns NULL set when called by another RETURNS TABLE
Date
Msg-id 23517.1266982478@sss.pgh.pa.us
Whole thread Raw
In response to RETURNS TABLE returns NULL set when called by another RETURNS TABLE  (Josh Berkus <josh@agliodbs.com>)
Responses Re: RETURNS TABLE returns NULL set when called by another RETURNS TABLE  (Josh Berkus <josh@agliodbs.com>)
List pgsql-bugs
Josh Berkus <josh@agliodbs.com> writes:
> Apparently if you use one returns table function to call a 2nd returns
> table function, it returns a recordset which consists entirely of nulls.

In HEAD that example fails with

psql:josh.sql:30: ERROR:  column reference "id1" is ambiguous
LINE 1: select id1, val1 from srf1(1)
               ^
DETAIL:  It could refer to either a PL/pgSQL variable or a table column.
QUERY:  select id1, val1 from srf1(1)
CONTEXT:  PL/pgSQL function "srf2" line 2 at RETURN QUERY

val1 is just as ambiguous.  I think you got bit by the name collision;
the output parameters would start out NULLs and thus lead to the
described behavior, in versions before 9.0.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Josh Berkus
Date:
Subject: RETURNS TABLE returns NULL set when called by another RETURNS TABLE
Next
From: Josh Berkus
Date:
Subject: Re: RETURNS TABLE returns NULL set when called by another RETURNS TABLE