Skip site navigation (1) Skip section navigation (2)

BUG #1784: "adding missing FROM-clause" when not needed

From: "Giacomo G" <matic999(at)hotmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #1784: "adding missing FROM-clause" when not needed
Date: 2005-07-25 02:03:54
Message-ID: 20050725020354.9BC6EF0B03@svr2.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      1784
Logged by:          Giacomo G
Email address:      matic999(at)hotmail(dot)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.

Responses

pgsql-bugs by date

Next:From: K.G.SivaramanDate: 2005-07-25 11:36:43
Subject: BUG #1785: Return code !!!
Previous:From: Tom LaneDate: 2005-07-24 17:32:52
Subject: Re: BUG #1783: A function using char variables does not behave the same way between 7.4 and 8.0

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group