Re: anonymous composite types for Table Functions (aka SRFs)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, pgsql-patches(at)postgresql(dot)org
Subject: Re: anonymous composite types for Table Functions (aka SRFs)
Date: 2002-08-05 13:37:10
Message-ID: 20322.1028554630@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Joe Conway <mail(at)joeconway(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2002-08-05 13:41:04 Re: PITR, checkpoint, and local relations
Previous Message Tom Lane 2002-08-05 13:33:21 Re: FUNC_MAX_ARGS benchmarks

Browse pgsql-patches by date

  From Date Subject
Next Message Joe Conway 2002-08-05 15:12:27 Re: anonymous composite types for Table Functions (aka
Previous Message Christopher Kings-Lynne 2002-08-05 08:40:00 pg_stat_reset round 3