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