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

From Richard Huxton
Subject Re: BUG #1784: "adding missing FROM-clause" when not needed
Date
Msg-id 42E4F5B1.7080200@archonet.com
Whole thread Raw
In response to BUG #1784: "adding missing FROM-clause" when not needed  ("Giacomo G" <matic999@hotmail.com>)
List pgsql-bugs
Giacomo G wrote:
>
> But, when i run the same query with the real name of table in the where
> statement I get this:

This isn't the "real name" of the table "t0". It is another reference to
table "foo", and as such should either raise an error or arrange to
alter the from-clause to make it valid (which is what happens).

> 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.

In recent versions, you can disable the feature in your postgresql.conf
by setting "add_missing_from" to false. See the manuals - run-time
environment / compatibility.

--
   Richard Huxton
   Archonet Ltd

pgsql-bugs by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: BUG #1784: "adding missing FROM-clause" when not needed
Next
From: Tom Lane
Date:
Subject: Re: BUG #1784: "adding missing FROM-clause" when not needed