Re: Preventing DELETE and UPDATE without a WHERE clause?

From: mark(at)mark(dot)mielke(dot)cc
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Chris Campbell <chris(at)bignerdranch(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Preventing DELETE and UPDATE without a WHERE clause?
Date: 2006-06-16 04:04:15
Message-ID: 20060616040415.GA20791@mark.mielke.cc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jun 15, 2006 at 10:35:19PM -0400, Tom Lane wrote:
> Chris Campbell <chris(at)bignerdranch(dot)com> writes:
> > I heard an interesting feature request today: preventing the
> > execution of a DELETE or UPDATE query that does not have a WHERE clause.
> These syntaxes are required by the SQL spec. Furthermore, it's easy
> to imagine far-more-probable cases in which the system wouldn't detect
> that you'd made a mistake, eg
> DELETE FROM tab WHERE key > 1
> where you meant to type
> DELETE FROM tab WHERE key > 10000000
> I suggest counseling your client to learn how to use BEGIN/ROLLBACK.
> This proposal strikes me as falling squarely within the rule about
> "design a system that even a fool can use, and only a fool will want
> to use it".

What about a mode that would activate after 2am, and before 6am, that
would prevent any delete or update operation that affects more than 50%
of the rows? :-)

Hehe.

Only half serious... :-)

Cheers,
mark

--
mark(at)mielke(dot)cc / markm(at)ncf(dot)ca / markm(at)nortel(dot)com __________________________
. . _ ._ . . .__ . . ._. .__ . . . .__ | Neighbourhood Coder
|\/| |_| |_| |/ |_ |\/| | |_ | |/ |_ |
| | | | | \ | \ |__ . | | .|. |__ |__ | \ |__ | Ottawa, Ontario, Canada

One ring to rule them all, one ring to find them, one ring to bring them all
and in the darkness bind them...

http://mark.mielke.cc/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message ITAGAKI Takahiro 2006-06-16 04:33:43 table/index fillfactor control, try 2
Previous Message Bruce Momjian 2006-06-16 04:01:53 Re: Re-thing PG_MODULE_MAGIC