pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
sql disaster - subquery error but delete continues
2+ messages / 2 participants
[nested] [flat]

* sql disaster - subquery error but delete continues
@ 2010-09-10 09:46  Greg Caulton <caultonpos@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Greg Caulton @ 2010-09-10 09:46 UTC (permalink / raw)
  To: pgsql-sql

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

Greg

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: sql disaster - subquery error but delete continues
@ 2010-09-10 10:07  Thomas Kellerer <spam_eater@gmx.net>
  parent: Greg Caulton <caultonpos@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Thomas Kellerer @ 2010-09-10 10:07 UTC (permalink / raw)
  To: pgsql-sql

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




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2010-09-10 10:07 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-09-10 09:46 sql disaster - subquery error but delete continues Greg Caulton <caultonpos@gmail.com>
2010-09-10 10:07 ` Thomas Kellerer <spam_eater@gmx.net>

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