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