Обсуждение: sql disaster - subquery error but delete continues

Поиск
Список
Период
Сортировка

sql disaster - subquery error but delete continues

От
Greg Caulton
Дата:
delete from form_record_details where form_record_id in (select form_record_id from forms where form_id= 40003656)<br
/><br/>Seems fine at 1am.<br /><br />However the subquery has a typo in it - there is no form_record_id in the forms
table<br/><br />But rather than psql throwing an error...<br /><br />it deletes every row in the form_record_details
table<br/><br />please tell me this is fixed since 8.3<br /><br />Greg<br /> 

Re: sql disaster - subquery error but delete continues

От
Thomas Kellerer
Дата:
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,
youare simply referencing the form_record_id from the "outer" table in the subquery.
 

Thomas