Implementation of LIMIT on DELETE and UPDATE statements (rel to 7.2.1)

From: srb(at)cuci(dot)nl (Stephen R(dot) van den Berg)
To: pgsql-patches(at)postgresql(dot)org
Subject: Implementation of LIMIT on DELETE and UPDATE statements (rel to 7.2.1)
Date: 2002-09-21 14:12:06
Message-ID: 20020921141206.GA32585@cuci.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

The patch allows for a LIMIT clause on a DELETE or UPDATE statement.
Why is this needed?
- I have a table which has several identical entries, and I want to
delete or update just one of them (I don't care which one, obviously).
And, no, I cannot use OIDS because they'd represent unwanted overhead
(the table contains a lot of entries).
- It allows you to speed up DELETE or UPDATE statements which are known
in advance to match only one record by adding a LIMIT 1.
- It makes migrations from MySQL to PostgreSQL easier (MySQL already
supports LIMIT on DELETEs and UPDATEs). It might simplify other migrations
as well, I'm not sure what other DBMSes support the construct.

The patch includes documentation updates (which might need to be edited
to change the look and feel to the rest of the documentation).

When checking the patches, please pay attention to the three extra warnings
the yacc file now generates. I looked into it, but can't see the
problem, actually (I'm probably overlooking something).
--
Sincerely, srb(at)cuci(dot)nl
Stephen R. van den Berg (AKA BuGless).

"Sleep: A completely inadequate substitute for caffeine."

Attachment Content-Type Size
dif text/plain 5.7 KB

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2002-09-21 15:24:25 Re: Implementation of LIMIT on DELETE and UPDATE statements (rel to 7.2.1)
Previous Message Nigel J. Andrews 2002-09-20 22:18:00 Re: Memory Errors...