Re: BUG #4220: delete statement deleted too many rows - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #4220: delete statement deleted too many rows
Date
Msg-id 28896.1212610089@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #4220: delete statement deleted too many rows  (hubert depesz lubaczewski <depesz@depesz.com>)
Responses Re: BUG #4220: delete statement deleted too many rows  ("Lon Varscsak" <varscsak@smarthealth.com>)
List pgsql-bugs
hubert depesz lubaczewski <depesz@depesz.com> writes:
> On Wed, Jun 04, 2008 at 06:46:42PM +0000, Lon Varscsak wrote:
>> delete from customer_transactions_detail where transaction_id in (select
>> transaction_id from test);
>> The transaction_id column does NOT exist in the temporary table named
>> 'test').  I would think this would just result in an error, instead it
>> delete all rows in the customer_transactions_detail table.

> i wrote about it in more details in here:
> http://www.depesz.com/index.php/2007/09/06/postgresql-gotchas/

This isn't a "postgres gotcha", it's a "SQL standard gotcha".  Any DBMS
that fails to execute the query exactly that way is violating the spec.

            regards, tom lane

pgsql-bugs by date:

Previous
From: hubert depesz lubaczewski
Date:
Subject: Re: BUG #4220: delete statement deleted too many rows
Next
From: Nathan Reed
Date:
Subject: Re: BUG #4219: fseeko test failure in configure script