Re: pg_advisory_lock problem - Mailing list pgsql-general

From Merlin Moncure
Subject Re: pg_advisory_lock problem
Date
Msg-id CAHyXU0yXWkVvy4MMXNMrGSLRDgFNbX78hiChwFtOncbxgWWA=Q@mail.gmail.com
Whole thread Raw
In response to Re: pg_advisory_lock problem  (Kevin Grittner <kgrittn@ymail.com>)
Responses Re: pg_advisory_lock problem  (Rémi Cura <remi.cura@gmail.com>)
List pgsql-general
On Mon, Aug 11, 2014 at 9:49 AM, Kevin Grittner <kgrittn@ymail.com> wrote:
> Rémi Cura <remi.cura@gmail.com> wrote:
>
>> 2014-08-11 5:33 GMT+02:00 John R Pierce <pierce@hogranch.com>:
>
>>> ah, you're releasing the lock before the insert is committed,
>>> since this is all within a function call, its entirely within a
>>> single transaction.
>
>> Oh no I hoped it was something fixable
>
> Well, it might be.  Try using a transactional advisory lock and
> letting it expire at the end of the transaction, rather than
> explicitly releasing it before the transaction commits.  Depending
> on some other details, that might get it to do what you want.

Better to use vanilla LOCK TABLE statement in my opinion for this purpose.

merlin


pgsql-general by date:

Previous
From: David Carpio
Date:
Subject: Re: pgcluu
Next
From: Adrian Klaver
Date:
Subject: Re: postgresql referencing and creating types as record