Hi,
Martijn van Oosterhout wrote:
>>popscan_light=> select aliasa.name, aliasb.name2 from a aliasa left join
>>b aliasb using (id) order by b.name2;
>>NOTICE: adding missing FROM-clause entry for table "b"
>> name | name2
>>-------+-----------
>> gnegg | gnegglink
>> blepp | blepplink
>> gnegg | gnegglink
>> blepp | blepplink
>>(4 rows)
>
>
> See that NOTIVCE? It's telling you that it's converted your query to:
actually, I've overseen it. But then, my assumption in my mail was
correct anyway.
> select aliasa.name, aliasb.name2 from b, a aliasa left join
> b aliasb using (id) order by b.name2;
> Since you now have an unconstrained join on the B table, you get twice
> as many rows.
This is what I thought.
> As for what's SQL standard, I think by a strict definition your query
> shouldn't be allowed at all, referencing an undefined table.
This is exactly what I think too. I mean: I know I made an error in my
query. It would just have been easier to find if PostgreSQL actually had
told me so (I'm not getting those NOTICEs from PHP...).
If it's wrong, it should be disallowed, not made worse by assuming a
completely wrong thing.
Thanks for your fast response anyway.
Philip