From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-sql@postgresql.org
Subject: Re: sql disaster - subquery error but delete continues
Date: Fri, 10 Sep 2010 12:07:37 +0200
Message-ID: <i6d019$gto$1@dough.gmane.org> (raw)
In-Reply-To: <AANLkTi=KP2hDszZDeaYNROKfJx0N85Tbe5iwK9q+w+j1@mail.gmail.com>
References: <AANLkTi=KP2hDszZDeaYNROKfJx0N85Tbe5iwK9q+w+j1@mail.gmail.com>
Greg Caulton, 10.09.2010 11:46:
> delete from form_record_details where form_record_id in (select form_record_id from forms where form_id= 40003656)
>
> Seems fine at 1am.
>
> However the subquery has a typo in it - there is no form_record_id in the forms table
>
> But rather than psql throwing an error...
>
> it deletes every row in the form_record_details table
>
> please tell me this is fixed since 8.3
This is not a bug.
I assume there is a form_record_id in the table form_record_details. As you have not used table prefixes or aliases, you are simply referencing the form_record_id from the "outer" table in the subquery.
Thomas
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: spam_eater@gmx.net
Subject: Re: sql disaster - subquery error but delete continues
In-Reply-To: <i6d019$gto$1@dough.gmane.org>
* 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