Rod Taylor <rbt(at)zort(dot)ca> writes:
>> I don't want to have to take a global lock whenever we
>> create an index.
> I don't understand why a global lock is necessary --
To be sure we are creating a unique constraint name.
> and not simply a lock on the pg_constraint table
In this context, a lock on pg_constraint *is* global, because it will
mean that no one else can be creating an index on some other table.
They'd need to hold that same lock to ensure that *their* chosen
constraint name is unique.
regards, tom lane