Re: SRF patch (was Re: [HACKERS] Set Returning Functions - Mailing list pgsql-patches

From Joe Conway
Subject Re: SRF patch (was Re: [HACKERS] Set Returning Functions
Date
Msg-id 3CD8B4D9.9060706@joeconway.com
Whole thread Raw
In response to SRF patch (was Re: [HACKERS] Set Returning Functions (SRF) - request for patch review and comment)  (Joe Conway <mail@joeconway.com>)
List pgsql-patches
Joe Conway wrote:
 > Tom Lane wrote:
 >
 >> Sure.  foo.foo is valid for a column foo in a table foo, so I
 >> don't see a problem with it for a function.
 >
 > Fixed

Sorry -- when I fixed this, I introduced a new bug which only shows for
functions returning composite types, and of course I tested one
returning a base type :(

If you do apply the last srf patch, please apply this one over it.

Thanks,

Joe

*** pgsql/src/backend/parser/parse_relation.c    Tue May  7 21:54:14 2002
--- pgsql.1/src/backend/parser/parse_relation.c    Tue May  7 21:44:13 2002
***************
*** 738,750 ****
           */
          Relation    rel;
          int            maxattrs;
-         int            numaliases;

          rel = heap_open(funcrelid, AccessShareLock);

-         eref = (Alias *) copyObject(alias);
-         numaliases = length(eref->colnames);
-
          /*
           * Since the rel is open anyway, let's check that the number of column
           * aliases is reasonable.
--- 738,746 ----
***************
*** 777,791 ****
           * Must be a base data type, i.e. scalar.
           * Just add one alias column named for the function.
           */
!         char       *attrname;
!         Func       *func;
!         Oid            funcid;
!
!         func = (Func *) (expr->oper);
!         funcid = func->funcid;
!         attrname = get_func_name(funcid);
!
!         eref->colnames = lappend(eref->colnames, makeString(attrname));
          rte->eref = eref;
      }

--- 773,779 ----
           * Must be a base data type, i.e. scalar.
           * Just add one alias column named for the function.
           */
!         eref->colnames = lappend(eref->colnames, makeString(funcname));
          rte->eref = eref;
      }


pgsql-patches by date:

Previous
From: Joe Conway
Date:
Subject: SRF patch (was Re: [HACKERS] Set Returning Functions (SRF) - request for patch review and comment)
Next
From: Alex Shevlakov
Date:
Subject: geometry type new code