From: Achilleas Mantzios <achill@matrix.gatewaynet.com>
To: pgsql-sql@postgresql.org
Subject: Re: bug in 9.2.2 ? subquery accepts wrong column name : upd
Date: Fri, 15 Mar 2013 09:49:36 +0200
Message-ID: <1736496.2mMupsnC8K@smadev.internal.net> (raw)
In-Reply-To: <17320.1363277866@sss.pgh.pa.us>
References: <1641558.Xf5bk256pC@smadev.internal.net>
<17320.1363277866@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>
Thanx Tom.
On Πεμ 14 ÎÎ±Ï 2013 12:17:46 Tom Lane wrote:
> 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
>
>
>
-
Achilleas Mantzios
IT DEV
IT DEPT
Dynacom Tankers Mgmt
--
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: achill@matrix.gatewaynet.com
Subject: Re: bug in 9.2.2 ? subquery accepts wrong column name : upd
In-Reply-To: <1736496.2mMupsnC8K@smadev.internal.net>
* 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