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

From Bruce Momjian
Subject Re: anonymous composite types for Table Functions (aka
Date
Msg-id 200208060534.g765YC009484@candle.pha.pa.us
Whole thread Raw
In response to Re: anonymous composite types for Table Functions (aka  (Joe Conway <mail@joeconway.com>)
List pgsql-patches
Patch applied.  Thanks.

---------------------------------------------------------------------------


Joe Conway wrote:
> Joe Conway wrote:
> > 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.
> >
>
> Simple change -- patch attached.
>
> test=# select * from myfoo1() as z;
>   z
> ----
>    1
>    2
>    3
> (3 rows)
>
> test=# select * from myfoo1();
>   myfoo1
> --------
>        1
>        2
>        3
> (3 rows)
>
>
> test=# select * from myfoo1() as z(a);
>   a
> ----
>    1
>    2
>    3
> (3 rows)
>
>
> Joe

> Index: src/backend/parser/parse_relation.c
> ===================================================================
> RCS file: /opt/src/cvs/pgsql-server/src/backend/parser/parse_relation.c,v
> retrieving revision 1.73
> diff -c -r1.73 parse_relation.c
> *** src/backend/parser/parse_relation.c    5 Aug 2002 02:30:50 -0000    1.73
> --- src/backend/parser/parse_relation.c    5 Aug 2002 05:22:02 -0000
> ***************
> *** 807,813 ****
>               elog(ERROR, "Too many column aliases specified for function %s",
>                    funcname);
>           if (numaliases == 0)
> !             eref->colnames = makeList1(makeString(funcname));
>       }
>       else if (functyptype == 'p' && funcrettype == RECORDOID)
>       {
> --- 807,813 ----
>               elog(ERROR, "Too many column aliases specified for function %s",
>                    funcname);
>           if (numaliases == 0)
> !             eref->colnames = makeList1(makeString(eref->aliasname));
>       }
>       else if (functyptype == 'p' && funcrettype == RECORDOID)
>       {

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: anonymous composite types for Table Functions (aka SRFs)
Next
From: Bruce Momjian
Date:
Subject: Re: anonymous composite types for Table Functions (aka