Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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."

Responses

pgsql-patches by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group