Re: pg_advisory_lock problem

From: John R Pierce <pierce(at)hogranch(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: pg_advisory_lock problem
Date: 2014-08-11 03:33:00
Message-ID: 53E8396C.5060806@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rémi Cura 2014-08-11 10:11:47 Re: pg_advisory_lock problem
Previous Message David G Johnston 2014-08-11 03:23:56 Re: pg_advisory_lock problem