Preventing DELETE and UPDATE without a WHERE clause?
От | Chris Campbell |
---|---|
Тема | Preventing DELETE and UPDATE without a WHERE clause? |
Дата | |
Msg-id | 3F1249A4-61D7-413E-BAB1-C9BE8E0E9CC2@bignerdranch.com обсуждение исходный текст |
Ответы |
Re: Preventing DELETE and UPDATE without a WHERE clause?
|
Список | 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
В списке pgsql-hackers по дате отправления: