Re: Is this a bug?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Harry Jackson" <harryjackson(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Is this a bug?
Date: 2007-07-01 18:52:20
Message-ID: 16023.1183315940@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Harry Jackson" <harryjackson(at)gmail(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Michael Fuhr 2007-07-01 19:16:16 Re: Trapping errors from pl/perl (trigger) functions
Previous Message Harry Jackson 2007-07-01 18:44:47 Is this a bug?