welcome to the joys of being a DBA ... :) That's why restorable backups, tst and dev environments are so so important. And yes, this kind of thing has kept me (and many others) busy more than once after a too speedily executed SQL statement.
regards Rob -----Original Message----- From: Dave Dyer [mailto:[EMAIL PROTECTED] Sent: Tuesday 01 April 2003 23:24 To: [EMAIL PROTECTED] Subject: fail-safe queries I'm a little concerned by the possibilty of a malformed query accidentally destroying a whole databse. For example, a badly constructed boolean, intended to select exactly one row, but which actually modifies all rows. update mytables set data='who' where row='1234'; (updates 1 row) verses update mytables set data='who where row=1234'; (damages all rows) The obvious answer is to use a LIMIT clause to limit the damage, but (1) there is still damagage (2) the LIMIT clause is as likely to be damaged as the WHERE. update mytables set data='who where row=1234' LIMIT 1; (damages 1 row, gives no indication of error. Better I suppose.) So my proposal is a "FAIL IF rows>1" type clause, which would be syntactically FIRST in the string, and so unlikely to be damaged by errors constructing a complex query. FAIL IF rows>1 update mytables set data='who where row=1234'; (fails, damaging no rows.) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]