Re: Prevent accidental whole-table DELETEs and UPDATEs

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Prevent accidental whole-table DELETEs and UPDATEs
Дата
Msg-id 1580673.1675373572@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Prevent accidental whole-table DELETEs and UPDATEs  (Nikolay Samokhvalov <samokhvalov@gmail.com>)
Список pgsql-hackers
Nikolay Samokhvalov <samokhvalov@gmail.com> writes:
> 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

This sort of thing has been proposed before and rejected before.
I do not think anything has changed.  In any case, I seriously
doubt that something that's basically a one-line test (excluding
overhead such as GUC definitions) is going to meaningfully
improve users' lives.  The cases that I actually see reported
are not "I left off the WHERE" but more like "I fat-fingered
a variable in a sub-select so that it's an outer reference,
causing the test to degenerate to WHERE x = x", or perhaps
"I misunderstood the behavior of NOT IN with nulls, ending up
with a constant-false or constant-true condition".  I'm not sure
if there's a reliable way to spot those sorts of not-so-trivial
semantic errors ... but if we could, that'd be worth discussing.

            regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Weird failure with latches in curculio on v15
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Remove unused code related to iso-8859-1 type