Skip site navigation (1) Skip section navigation (2)

Re: BUG #4247: (Possible) SQL miscontruct not flagged

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "J6M" <j6m(at)adm(dot)estp(dot)fr>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4247: (Possible) SQL miscontruct not flagged
Date: 2008-06-17 17:47:13
Message-ID: 24860.1213724833@sss.pgh.pa.us (view raw, whole thread or download thread mbox)
Thread:
Lists: pgsql-bugs
"J6M" <j6m(at)adm(dot)estp(dot)fr> writes:
> PostgreSQL version: 8.1.13

> I wrote :

> select distinct(ean13),(select count(*) into zz from fiart where
> ean13=a.ean13) as n from fiart as a ;

> I am not an expert in the most intricate shades of the SQL language. Should
> the SQL interpreter not flag the query as a misconstruct statement and fire
> an ERROR (or at least a WARNING) message ? (I'd guess it should).

8.2 and up do complain about this:

regression=# create table fiart (ean13 int);
CREATE TABLE
regression=# select distinct(ean13),(select count(*) into zz from fiart where ean13=a.ean13) as n from fiart as a ;
ERROR:  bad query in sub-select

			regards, tom lane

In response to

pgsql-bugs by date

Next:From: Wojciech TylekDate: 2008-06-17 20:37:24
Subject: BUG #4250: subquery in query
Previous:From: J6MDate: 2008-06-17 17:13:20
Subject: BUG #4247: (Possible) SQL miscontruct not flagged

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group