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

From Bruce Momjian
Subject Re: Fix for tablename in targetlist
Date
Msg-id 200105191209.f4JC90D15198@candle.pha.pa.us
Whole thread Raw
In response to Re: Fix for tablename in targetlist  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
> Bruce Momjian writes:
> 
> > This patch fixes the problem by generating an error in the parser:
> >
> >     test=> select pg_class from pg_class;
> >     ERROR:  You can't use a relation alone in a target list.
> 
> Maybe it's the parser that's getting it wrong.  What if pg_class has a
> column called pg_class?

The parser doesn't know about columns or table names.  It just passes
them along.  The code checks the indent and sets isRel if it matches
something in the range table.  Seems like it checks for column matches
in the range table first.  Looks OK:test=> create table test (test int);CREATEtest=> insert into test values (1);INSERT
1455701test=> select test from test; test ------    1(1 row)
 

--  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: Ondrej Palkovsky
Date:
Subject: TRUNCATE doesn't follow referential integrity
Next
From: Bruce Momjian
Date:
Subject: Re: Plans for solving the VACUUM problem