Re: DELETE with LIMIT (or my first hack)

Поиск
Список
Период
Сортировка
От Kevin Grittner
Тема Re: DELETE with LIMIT (or my first hack)
Дата
Msg-id 4CF4F8560200002500037FA4@gw.wicourts.gov
обсуждение исходный текст
Ответ на Re: DELETE with LIMIT (or my first hack)  (Daniel Loureiro <daniel@termasa.com.br>)
Ответы Re: DELETE with LIMIT (or my first hack)  (Andrew Dunstan <andrew@dunslane.net>)
Список pgsql-hackers
Daniel Loureiro <daniel@termasa.com.br> wrote:
> to me the key its security - its a anti-DBA-with-lack-of-attention
> feature.
Well, it seems pretty weak to me for that purpose.  You still trash
data, and you don't have any immediate clue as to what.  If you
wanted protection from that you'd want more of an "assert limit"
that would fail if the affected row count was above what you
specified.
For me the best solution is to develop good habits.  I first type my
statement as "SELECT * FROM ..." and after reviewing the results
arrow up and replace "SELECT *" with "DELETE".  If there's enough
volatility or complexity to make that insufficient insurance, I
begin a transaction.  That way I can not only review row counts but
run queries against the modified data to confirm correct
modification before issuing a COMMIT (or ROLLBACK).
The batching of updates so that vacuums can make space available for
re-use is more compelling to me, but still pretty iffy, since the
work-arounds aren't that hard to find.
-Kevin


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [GENERAL] column-level update privs + lock table
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: DELETE with LIMIT (or my first hack)