> Bruce Momjian <[EMAIL PROTECTED]> writes:
> > OK, here is another patch that does this:
> 
> That seems considerably uglier than your first patch.  In particular,
> why aren't you looking for isRel being set in the Ident node?  It
> looks to me like you may have changed the behavior in the case where
> the Ident could be either a table or column name.

OK, here is a new patch.  I thought I had to go through
transformTargetEntry() -> transformExpr() -> transformIdent() to get
Ident.isRel set.  Seems it is set earlier too, so the new code is
shorter.  I am still researching the purpose of Ident.isRel.  If someone
knows, please chime in.  I know it says the Ident is a relation, but why
have a field when you can look it up in the rangetable?

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  [EMAIL PROTECTED]               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
Index: doc/TODO
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/doc/TODO,v
retrieving revision 1.464
diff -c -r1.464 TODO
*** doc/TODO    2001/05/18 16:28:12     1.464
--- doc/TODO    2001/05/20 00:35:29
***************
*** 140,146 ****
  * Allow RULE recompilation
  * Add BETWEEN ASYMMETRIC/SYMMETRIC
  * Change LIMIT val,val to offset,limit to match MySQL
! * Allow Pl/PgSQL's RAISE function to take expressions
  * ALTER
        * ALTER TABLE ADD COLUMN to inherited table put column in wrong place
          [inheritance]
--- 140,146 ----
  * Allow RULE recompilation
  * Add BETWEEN ASYMMETRIC/SYMMETRIC
  * Change LIMIT val,val to offset,limit to match MySQL
! * Allow PL/PgSQL's RAISE function to take expressions
  * ALTER
        * ALTER TABLE ADD COLUMN to inherited table put column in wrong place
          [inheritance]
Index: src/backend/parser/parse_target.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/parser/parse_target.c,v
retrieving revision 1.66
diff -c -r1.66 parse_target.c
*** src/backend/parser/parse_target.c   2001/03/22 03:59:41     1.66
--- src/backend/parser/parse_target.c   2001/05/20 00:35:30
***************
*** 154,166 ****
                }
                else
                {
!                       /* Everything else but Attr */
!                       p_target = lappend(p_target,
!                                                          transformTargetEntry(pstate,
!                                                                                      
                 res->val,
!                                                                                      
                 NULL,
!                                                                                      
                 res->name,
!                                                                                      
                 false));
                }
  
                targetlist = lnext(targetlist);
--- 154,182 ----
                }
                else
                {
!                       Node       *rteorjoin;
!                       int                     sublevels_up;
! 
!                       if (IsA(res->val, Ident) && ((Ident *) res->val)->isRel)
!                       {
!                               rteorjoin = refnameRangeOrJoinEntry(pstate,
!                                                                                      
         ((Ident *) res->val)->name,
!                                                                                      
         &sublevels_up);
!                               Assert(rteorjoin != NULL);
!                               p_target = nconc(p_target,
!                                                       expandRelAttrs(pstate,
!                                                          (RangeTblEntry *) 
rteorjoin));
!                       }
!                       else
!                       {
!                               /* Everything else */
!                               p_target = lappend(p_target,
!                                                                  
transformTargetEntry(pstate,
!                                                                                      
                         res->val,
!                                                                                      
                         NULL,
!                                                                                      
                         res->name,
!                                                                                      
                         false));
!                       }
                }
  
                targetlist = lnext(targetlist);

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Reply via email to