From: Tom Lane <tgl@sss.pgh.pa.us>
To: Achilleas Mantzios <achill@matrix.gatewaynet.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: bug in 9.2.2 ? subquery accepts wrong column name : upd
Date: Thu, 14 Mar 2013 12:17:46 -0400
Message-ID: <17320.1363277866@sss.pgh.pa.us> (raw)
In-Reply-To: <1641558.Xf5bk256pC@smadev.internal.net>
References: <1641558.Xf5bk256pC@smadev.internal.net>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>
Achilleas Mantzios <achill@matrix.gatewaynet.com> writes:
> dynacom=# SELECT DISTINCT ON (qry.setid) qry.setid, qry.arragg[1:2] FROM
> (select distinct sst.setid,(array_agg(vsl.name) OVER (PARTITION BY sst.setid ORDER BY character_length(vsl.name))) as arragg
> FROM sissets sst, vessels vsl WHERE vsl.id=sst.vslid ORDER BY sst.setid) as qry
> WHERE array_length(qry.arragg,1)>1 AND qry.setid IN (SELECT setid from sis_oper_cons) ORDER BY qry.setid,array_length(qry.arragg,1);
> [ works ]
> however, there is not column setid in sis_oper_cons,
If not, that's a perfectly legal outer reference to qry.setid.
Probably not one of SQL's better design features, since it confuses
people regularly; but it's required by spec to work like that.
regards, tom lane
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, achill@matrix.gatewaynet.com
Subject: Re: bug in 9.2.2 ? subquery accepts wrong column name : upd
In-Reply-To: <17320.1363277866@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox