Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 6675F4760F8 for ; Tue, 26 Nov 2002 12:22:52 -0500 (EST) Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id 257584760D7 for ; Tue, 26 Nov 2002 12:22:47 -0500 (EST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 26307D606; Tue, 26 Nov 2002 09:22:52 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 1BEAF5C02; Tue, 26 Nov 2002 09:22:52 -0800 (PST) Date: Tue, 26 Nov 2002 09:22:52 -0800 (PST) From: Stephan Szabo To: Richard Huxton Cc: patrick , Subject: Re: Are sub-select error suppressed? In-Reply-To: <1081.192.168.1.16.1038330273.squirrel@mainbox.archonet.com> Message-ID: <20021126092033.F78435-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200211/404 X-Sequence-Number: 10546 On Tue, 26 Nov 2002 dev@archonet.com wrote: > > On Tue, 26 Nov 2002, Richard Huxton wrote: > > > >> On Tuesday 26 Nov 2002 9:43 am, patrick wrote: > >> > Greetings, > >> > > >> > I'm not sure what the correct behavior is here but the observed > >> > behavior seems "wrong" (or at least undesirable). > > >> Don't look right to me, and I still see it here in 7.2 and the 7.3 beta > >> I've > >> got (note - not most recent). I don't think it's in the subselect itself > >> - > >> what's happening is when you do > > > > I think it's standard behavior. The column reference is an outer > > reference I believe, IIRC all the names from the outer query are in scope > > in the subselect (although if there's an equivalent name in the subselect > > from tables you'd have to qualify it). > > Ah - of course. Otherwise you couldn't do a subselect where foo=outer_foo. > It tries to bind within the subselect, fails, then binds to the outer > clause. > > Obvious now Stephan's pointed it out. Also reminds me why I like table > aliases for any complicated queries. Yeah, they could have (or at least if they did I couldn't find it this morning) required at least table qualifying outer references. That would have let the same functionality at the cost of only a few extra characters while being more obvious. It'd mean that you'd have to table alias things in subselects where you wanted to get to the same tablename in a higher scope, but it wouldn't have been that bad.