Re: Fix for tablename in targetlist - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Fix for tablename in targetlist
Date
Msg-id 200105200250.f4K2oHs03555@candle.pha.pa.us
Whole thread Raw
In response to Re: Fix for tablename in targetlist  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: Fix for tablename in targetlist
List pgsql-hackers
> > Bruce Momjian <pgman@candle.pha.pa.us> 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?

This patch was no good.  It worked only because I had created test as:
CREATE TABLE test ( test int);

to test Peter's test of matching column/table names.  In fact, I was
right that you have to call transformTargetEntry() -> transformExpr() ->
transformIdent() to get isRel set, and I have to do the longer fix.

--  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,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: mlw
Date:
Subject: Re: External search engine, advice
Next
From: Tom Lane
Date:
Subject: Re: Re: External search engine, advice