Re: Bug or stupidity - Mailing list pgsql-general

From Philip Hofstetter
Subject Re: Bug or stupidity
Date
Msg-id 417A6C28.3060903@sensational.ch
Whole thread Raw
In response to Re: Bug or stupidity  (Martijn van Oosterhout <kleptog@svana.org>)
Responses Re: Bug or stupidity  (Martijn van Oosterhout <kleptog@svana.org>)
Re: Bug or stupidity  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Re: Bug or stupidity  (Karim Nassar <Karim.Nassar@NAU.EDU>)
List pgsql-general
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

pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: Bug or stupidity
Next
From: Eddy Macnaghten
Date:
Subject: Re: OID's