Re: pg_advisory_lock problem - Mailing list pgsql-general

From John R Pierce
Subject Re: pg_advisory_lock problem
Date
Msg-id 53E8396C.5060806@hogranch.com
Whole thread Raw
In response to Re: pg_advisory_lock problem  (David G Johnston <david.g.johnston@gmail.com>)
Responses Re: pg_advisory_lock problem  (Rémi Cura <remi.cura@gmail.com>)
List pgsql-general
---------
>PERFORM pg_advisory_lock(#1 , 2 or 3 depending on the table#,id of the
>stuff I want to upsert) ;
>WITH stuff_to_upsert ()
>,updating AS (update returning id)
>,inserting AS (insert if not updated)
>PERFORM pg_advisory_unlock(same as above).
>--------


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.



--
john r pierce                                      37N 122W
somewhere on the middle of the left coast



pgsql-general by date:

Previous
From: David G Johnston
Date:
Subject: Re: pg_advisory_lock problem
Next
From: Rémi Cura
Date:
Subject: Re: pg_advisory_lock problem