BUG #1784: "adding missing FROM-clause" when not needed - Mailing list pgsql-bugs

From Giacomo G
Subject BUG #1784: "adding missing FROM-clause" when not needed
Date
Msg-id 20050725020354.9BC6EF0B03@svr2.postgresql.org
Whole thread Raw
Responses Re: BUG #1784: "adding missing FROM-clause" when not needed  (Michael Fuhr <mike@fuhr.org>)
Re: BUG #1784: "adding missing FROM-clause" when not needed  (Richard Huxton <dev@archonet.com>)
Re: BUG #1784: "adding missing FROM-clause" when not needed  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
The following bug has been logged online:

Bug reference:      1784
Logged by:          Giacomo G
Email address:      matic999@hotmail.com
PostgreSQL version: 8.0.3
Operating system:   linux kernel 2.6.12.2
Description:        "adding missing FROM-clause" when not needed
Details:

If I populate the database with this two tables:

CREATE TABLE bar ( c varchar, d varchar);
CREATE TABLE foo ( a varchar, b varchar);
COPY bar (c, d) FROM stdin;
1       ghi
2       jkl
\.
COPY foo (a, b) FROM stdin;
1       abc
2       def
\.

When I run this select I get the output I expect:

test=# select * from foo t0 join bar t1 on ( t0.a = t1.c ) where t0.a = 1;
 a |  b  | c |  d
---+-----+---+-----
 1 | abc | 1 | ghi
(1 row)


But, when i run the same query with the real name of table in the where
statement I get this:

test=# select * from foo t0 join bar t1 on ( t0.a = t1.c ) where foo.a = 1;
NOTICE:  adding missing FROM-clause entry for table "foo"
 a |  b  | c |  d
---+-----+---+-----
 1 | abc | 1 | ghi
 2 | def | 2 | jkl
(2 rows)

while I expect the same result of the first query.

pgsql-bugs by date:

Previous
From: "K.G.Sivaraman"
Date:
Subject: BUG #1785: Return code !!!
Next
From: Michael Fuhr
Date:
Subject: Re: BUG #1784: "adding missing FROM-clause" when not needed