DELETE with LIMIT (or my first hack)

From: Daniel Loureiro <loureirorg(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: DELETE with LIMIT (or my first hack)
Date: 2010-11-30 02:08:02
Message-ID: AANLkTi=6fBZh9yZT7f7kKh+zmQngAyHgZWBPM3eiEMj1@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

frequently i have accidents with DELETE/UPDATE commands. In fact, sometimes
in the last 8 or 9 years (ok, a lot of times) I forget the entire WHERE
clause or have a “not so perfectly“ WHERE clause, with an awful suprise.
There’s no words to figure the horror ever time i see that the number of
affected rows its not 1 or two how expected, but the entire table. So I
planned to make a hack to make the “LIMIT” directive available to “DELETE”
command.

So, can anyone help-me in how to do this ? This its my plan: 1) change the
lex grammar (wheres the file ?) 2) change the parser to accept the new
grammar 3) change the executor to stop after “n” successful iterations. Is
this correct ?

Greets,
--

Daniel Loureiro
------------------------------
http://diffcoder.blogspot.com/

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Itagaki Takahiro 2010-11-30 02:16:51 Re: dblink versus long connection strings
Previous Message Bruce Momjian 2010-11-30 01:34:06 Re: profiling connection overhead