Re: Erratic error message "ERROR: column "id_compte" does

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Pradier <dpradier(at)apartia(dot)fr>
Cc: Richard Huxton <dev(at)archonet(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Erratic error message "ERROR: column "id_compte" does
Date: 2005-03-16 15:17:17
Message-ID: 6025.1110986237@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

David Pradier <dpradier(at)apartia(dot)fr> writes:
> One can access the columns of the main query from the subquery,
> therefore in my own query the column "id_compte" is found,
> therefore there is no error message.

> Doesn't this count as a bug ?

No; it's required behavior per the SQL specification. The spec doesn't
restrict the sub-query to reference outer columns in only some places;
it can use them anywhere.

(If you think that's weird, you should try putting the outer reference
in an aggregate function ... it then counts as an aggregate of the outer
query, not the inner. Also per spec.)

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-03-16 15:24:26 Re: read-only database
Previous Message Bruce Momjian 2005-03-16 15:07:28 Re: [pgsql-hackers-win32] snprintf causes regression tests