using WHERE and AND in SELECT

Started by Jean-Yves MARTINalmost 9 years ago2 messagesbugs
Jump to latest
#1Jean-Yves MARTIN
Jean-Yves.Martin@ec-nantes.fr

Hi,

We had an issue when writing a SELECT request : we write:
select personne_id from personne inner join conducteur on (conducteur.personne_id=personne.personne_id) and personne.personne_id<20

instead of:
select personne_id from personne inner join conducteur on (conducteur.personne_id=personne.personne_id) where personne.personne_id<20

and there is no syntax error. both give the same result.

is it a bug in the SQL grammar or is it a usable syntax?

regards,

JY Martin.

Jean-Yves MARTIN
Responsable Option Informatique

Dept Informatique et Mathématiques
Centrale Nantes
1 rue de la Noë
44321 Nantes, cedex 3
France

Tel: +33 2 40 37 25 98
Mail: Jean-Yves.Martin@ec-nantes.fr <mailto:Jean-Yves.Martin@ec-nantes.fr>

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Jean-Yves MARTIN (#1)
Re: using WHERE and AND in SELECT

Jean-Yves MARTIN <Jean-Yves.Martin@ec-nantes.fr> writes:

We had an issue when writing a SELECT request : we write:
select personne_id from personne inner join conducteur on (conducteur.personne_id=personne.personne_id) and personne.personne_id<20

There's no requirement for parentheses around the JOIN condition,
so that's perfectly legal.

regards, tom lane

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs