Re: documentation about explicit locking - Mailing list pgsql-hackers

From Amit Langote
Subject Re: documentation about explicit locking
Date
Msg-id 9058205c-7847-d396-1088-378f3159bc17@lab.ntt.co.jp
Whole thread Raw
In response to Re: documentation about explicit locking  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
List pgsql-hackers
On 2018/07/31 5:27, Peter Eisentraut wrote:
> On 19/07/2018 06:17, Amit Langote wrote:
>> When playing with this, I observed that a less user-friendly error message
>> is emitted if multiple sessions race to create the same collation.
>>
>> Session 1:
>> begin;
>> create collation collname (...);
>>
>> Session 2:
>> create collation collname (...);
>> <blocks for lock on pg_collation>
>>
>> Session 1:
>> commit;
>>
>> Session 2:
>> ERROR:  duplicate key value violates unique constraint
>> "pg_collation_name_enc_nsp_index"
>> DETAIL:  Key (collname, collencoding, collnamespace)=(collname, 6, 2200)
>> already exists.
> 
> You get the same behavior with for example CREATE FUNCTION or CREATE
> TYPE.  I don't think we need to fix this specifically for CREATE COLLATION.

Hmm, yeah.  Although fixing the race for CREATE COLLATION seems easier
than other cases due to the self-exclusive lock on the catalog, that
doesn't necessarily mean we have to.

Thanks,
Amit



pgsql-hackers by date:

Previous
From: Amit Langote
Date:
Subject: Re: documentation about explicit locking
Next
From: Etsuro Fujita
Date:
Subject: Re: Expression errors with "FOR UPDATE" and postgres_fdw with partitionwise join enabled.