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ZWlnbl9zZXJ2ZXIgcyBv
biAKcy5vaWQgPSBwZ191c2VyX21hcHBpbmcudW1zZXJ2ZXI7CgrilIzilIDilIDilIDilIDilIDi
lIDilIDilIDilIDilIDilKzilIDilIDilIDilIDilIDilJAK4pSCIHVtc2VydmVyICDilIIgb2lk
ICAg4pSCCuKUnOKUgOKUgOKUgOKUgOKUgOKUgOKUgOKUgOKUgOKUgOKUvOKUgOKUgOKUgOKUgOKU
gOKUpArilII2MjE3MiAgICAJICAg4pSCICDCpCAgICAg4pSCCuKUlOKUgOKUgOKUgOKUgOKUgOKU
gOKUgOKUgOKUgOKUgOKUtOKUgOKUgOKUgOKUgOKUgOKUmA==

Re: Concurrent CREATE USER MAPPING and DROP SERVER

From
Tom Lane
Date:
Ronan Dunklau <rdunklau@gmail.com> writes:
> It is possible to create a user mapping on a server and drop said server in
> two concurrent transactions, and have both succeed.

There are lots of hazards of this sort, since we generally don't try to
lock database objects other than tables when doing DDL.  I can't get
particularly excited about this one compared to the rest.  We could try
to extend the table-locking protocols to apply to all object types ...
but from here, the amount of work and complexity involved seems far out
of proportion to the benefit.

            regards, tom lane