Re: Fix for tablename in targetlist

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fix for tablename in targetlist
Date: 2001-05-19 12:09:00
Message-ID: 200105191209.f4JC90D15198@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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);
CREATE
test=> insert into test values (1);
INSERT 145570 1
test=> select test from test;
test
------
1
(1 row)

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2001-05-19 12:12:28 Re: Plans for solving the VACUUM problem
Previous Message Ondrej Palkovsky 2001-05-19 10:56:48 TRUNCATE doesn't follow referential integrity