pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: Richard Huxton <dev@archonet.com>
Cc: patrick <patrick+pgsql@boxsoft.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Are sub-select error suppressed?
Date: Tue, 26 Nov 2002 07:52:20 -0800 (PST)
Message-ID: <20021126075031.N77510-100000@megazone23.bigpanda.com> (raw)
In-Reply-To: <200211261041.50766.dev@archonet.com>

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).
> >
> > I have a few tables and a view on one of the tables selecting
> > entries that may be purged.
> >
> > My delete statement uses the view to delete data from one of the
> > tables.  Like so:
> >
> >   delete from tab1 where id1 in ( select id from view1 );
> >
> > Assume that the view doesn't have a field named "id".  The select
> > statement alone would cause an error.  However, in this context it
> > doesn't and the delete statement deletes everything from tab1.
> >
> > Is this a bug in PostgreSQL or an "As Designed" feature?
>
> 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).




view thread (5+ messages)  latest in thread

Message-ID: <20021126075031.N77510-100000@megazone23.bigpanda.com>
Permalink:  ../20021126075031.N77510-100000@megazone23.bigpanda.com/
Also on:    postgresql.org/message-id/20021126075031.N77510-100000@megazone23.bigpanda.com

 · 

reply

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: sszabo@megazone23.bigpanda.com, dev@archonet.com, patrick+pgsql@boxsoft.com
  Subject: Re: Are sub-select error suppressed?
  In-Reply-To: <20021126075031.N77510-100000@megazone23.bigpanda.com>

* 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