Re: sequence locking

From: Andres Freund <andres(at)anarazel(dot)de>
To: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: "Merlin Moncure" <mmoncure(at)gmail(dot)com>, "PG Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: sequence locking
Date: 2011-09-21 17:15:04
Message-ID: 201109211915.05231.andres@anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wednesday 21 Sep 2011 19:03:17 Kevin Grittner wrote:
> Merlin Moncure <mmoncure(at)gmail(dot)com> wrote:
> > On Wed, Sep 21, 2011 at 11:51 AM, Kevin Grittner
> >
> > <Kevin(dot)Grittner(at)wicourts(dot)gov> wrote:
> >> Andres Freund <andres(at)anarazel(dot)de> wrote:
> >>> - Its impossible to emulate proper locking yourself because
> >>> locking is not allowed for sequences
> >>>
> >>> Any arguments against allowing it again? It seems to have been
> >>> allowed in prehistoric times.
> >>
> >> It would be nice to allow it. I've had to create a dummy table
> >> just to use for locking a sequence (by convention).
> >
> > another (better?) way is advisory locks...
>
> Not under 9.0 or earlier if you want the lock to last until the end
> of the transaction. Also, the fact that advisory locks are only on
> numbers, without any mechanism for mapping those to character
> strings, makes them poorly suited to many tasks.
The usual trick is to lock on the oid of some database object. But I agree,
its a poor workaround for this specific problem.

Andres

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2011-09-21 17:23:49 Re: Hot Backup with rsync fails at pg_clog if under load
Previous Message Robert Haas 2011-09-21 17:13:29 Re: unite recovery.conf and postgresql.conf