Re: remove upsert example from docs

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Merlin Moncure" <mmoncure(at)gmail(dot)com>, "PostgreSQL-development" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: remove upsert example from docs
Date: 2010-08-05 18:03:25
Message-ID: 4C5AB69D020000250003427B@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Merlin Moncure <mmoncure(at)gmail(dot)com> wrote:

> Attached is a patch to remove the upsert example from the pl/pgsql
> documentation. It has a serious bug (see:
> http://www.spinics.net/lists/pgsql/msg112560.html) which is
> nontrivial to fix. IMNSHO, our code examples should encourage
> good practices and style.
>
> The 'correct' way to do race free upsert is to take a table lock
> first -- you don't have to loop or open a subtransaction. A high
> concurrency version is nice but is more of a special case solution
> (it looks like concurrent MERGE might render the issue moot
> anyways).

Of course, this can be done safely without a table lock if either or
both of the concurrency patches (one by Florian, one by Dan and
myself) get committed, so maybe we should wait to see whether either
of them makes it before adjusting the docs on this point -- at least
for 9.1. Taking a broken example out of 9.0 and back branches might
make sense....

-Kevin

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Mike Lewis 2010-08-05 18:06:23 Re: Performance Enhancement/Fix for Array Utility Functions
Previous Message Robert Haas 2010-08-05 18:02:44 Re: Two different methods of sneaking non-immutable data into an index