Prevent accidental whole-table DELETEs and UPDATEs - Mailing list pgsql-hackers

From Nikolay Samokhvalov
Subject Prevent accidental whole-table DELETEs and UPDATEs
Date
Msg-id CANNMO++s0ayutEaM8qu+MDzPOAvWnc8uJSfBSWCRh+MKZoBjNw@mail.gmail.com
Whole thread Raw
Responses Re: Prevent accidental whole-table DELETEs and UPDATEs
List pgsql-hackers
In many cases, a DELETE or UPDATE not having a WHERE clause (or having it with a condition matching all rows in the table) is a sign of some kind of mistake, leading to accidental data loss, performance issues, producing a lot of dead tuples, and so on. Recently, this topic was again discussed [1]

Attached is a patch implemented by Andrey Boroding (attached) during our today's online session [2], containing a rough prototype for two new GUCs:

- prevent_unqualified_deletes
- prevent_unqualified_updates

Both are "false" by default; for superusers, they are not applied.

There is also another implementation of this idea, in the form of an extension [3], but I think having this in the core would be beneficial to many users.

Looking forward to your feedback.

Attachment

pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: Amcheck verification of GiST and GIN
Next
From: Andrew Dunstan
Date:
Subject: Re: run pgindent on a regular basis / scripted manner