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

From Joe Conway
Subject Re: anonymous composite types for Table Functions (aka
Date
Msg-id 3D4E13C6.6050700@joeconway.com
Whole thread Raw
In response to Re: anonymous composite types for Table Functions (aka SRFs)  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: anonymous composite types for Table Functions (aka  (Bruce Momjian <pgman@candle.pha.pa.us>)
Re: anonymous composite types for Table Functions (aka  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-patches
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)
      {

pgsql-patches by date:

Previous
From: Joe Conway
Date:
Subject: Re: anonymous composite types for Table Functions (aka
Next
From: Joe Conway
Date:
Subject: Re: anonymous composite types for Table Functions (aka