> > 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.
So I am understanding correctly.
I think it would be a rare event to have more than one person changing
the database structure at the same time. Anyway, the index example is a
bad example isn't it? It already takes an lock on pg_class which is
just as global.
Check constraints and foreign key constraints are two that I can see
affected in the manner described.
Anyway, my current implementation has constraint names unique to the
relation only -- not the namespace, although my locking may be excessive
in that area.