From: | Chris Campbell <chris(at)bignerdranch(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Preventing DELETE and UPDATE without a WHERE clause? |
Date: | 2006-06-16 01:40:22 |
Message-ID: | 3F1249A4-61D7-413E-BAB1-C9BE8E0E9CC2@bignerdranch.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I heard an interesting feature request today: preventing the
execution of a DELETE or UPDATE query that does not have a WHERE clause.
The user was worried about a typo leading to:
DELETE FROM very_important_table
and deleting all the data. Or doing something similar with an UPDATE:
UPDATE very_important_table SET important_column = 'Smith'
and all the rows now have their important_column set to Smith.
I was thinking that this could be accomplished with a GUC to cause
the server to report an error if DELETE and UPDATE queries don't
contain WHERE clauses. "allow_mod_queries_without_qualifier" or
something (which would obviously default to true).
If this setting was activated (the GUC changed to false), the above
queries could still be executed, but it would take a conscious effort
by the user to add a WHERE clause:
DELETE FROM very_important_table WHERE true;
UPDATE very_important_table SET important_column = 'Smith' WHERE
true;
Would such a patch ever be accepted?
Thanks!
- Chris
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2006-06-16 01:56:34 | Re: Test request for Stats collector performance improvement |
Previous Message | Qingqing Zhou | 2006-06-16 01:34:12 | Re: Test request for Stats collector performance improvement |