Re: Is this a bug? - Mailing list pgsql-general

From Tom Lane
Subject Re: Is this a bug?
Date
Msg-id 16023.1183315940@sss.pgh.pa.us
Whole thread Raw
In response to Is this a bug?  ("Harry Jackson" <harryjackson@gmail.com>)
List pgsql-general
"Harry Jackson" <harryjackson@gmail.com> writes:
> If I made a mistake and changed the "id" column to "user_id" then from
> some the statement executes.

> =# delete from map_users_roles where user_id = (select user_id from
> users WHERE  username = 'blah');

This is a standard "outer reference" construction, ie, user_id refers to
the field exposed in the outer-level query if there's no match in the
inner query.  Possibly the SQL spec authors should have made it a little
harder to invoke an outer reference, but they didn't.

            regards, tom lane

pgsql-general by date:

Previous
From: "Harry Jackson"
Date:
Subject: Is this a bug?
Next
From: Michael Fuhr
Date:
Subject: Re: Trapping errors from pl/perl (trigger) functions