Re: RETURNS TABLE returns NULL set when called by another RETURNS TABLE

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: RETURNS TABLE returns NULL set when called by another RETURNS TABLE
Date: 2010-02-24 03:34:38
Message-ID: 23517.1266982478@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Josh Berkus <josh(at)agliodbs(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Josh Berkus 2010-02-24 03:37:00 Re: RETURNS TABLE returns NULL set when called by another RETURNS TABLE
Previous Message Josh Berkus 2010-02-24 01:48:29 RETURNS TABLE returns NULL set when called by another RETURNS TABLE