Re: anonymous composite types for Table Functions (aka SRFs) - Mailing list pgsql-patches

From Tom Lane
Subject Re: anonymous composite types for Table Functions (aka SRFs)
Date
Msg-id 20322.1028554630@sss.pgh.pa.us
Whole thread Raw
In response to Re: anonymous composite types for Table Functions (aka  (Joe Conway <mail@joeconway.com>)
List pgsql-patches
Joe Conway <mail@joeconway.com> writes:
> Tom Lane wrote:
>> Hm.  I'd sort of expect the "z" to become both the table and column
>> alias in this case.  What do you think?

> I guess that would make sense. I'll make a separate patch just for that
> change if that's OK.

In the cold light of morning I started to wonder what should happen if
you write "from foo() as z" when foo returns a tuple.  It would probably
be peculiar for the z to overwrite the column name of just the first
column --- there is no such column renaming for an ordinary table alias.

My current thought: z becomes the table alias, and it also becomes the
column alias *if* the function returns scalar.  For a function returning
tuple, this syntax doesn't affect the column names.  (In any case this
syntax is disallowed for functions returning RECORD.)

            regards, tom lane

pgsql-patches by date:

Previous
From: "Christopher Kings-Lynne"
Date:
Subject: pg_stat_reset round 3
Next
From: Joe Conway
Date:
Subject: Re: anonymous composite types for Table Functions (aka