---------
>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