pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedConcurrent CREATE USER MAPPING and DROP SERVER
2+ messages / 2 participants
[nested] [flat]
* Concurrent CREATE USER MAPPING and DROP SERVER
@ 2013-07-04 14:27 Ronan Dunklau <rdunklau@gmail.com>
2013-07-04 15:03 ` Re: Concurrent CREATE USER MAPPING and DROP SERVER Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 2+ messages in thread
From: Ronan Dunklau @ 2013-07-04 14:27 UTC (permalink / raw)
To: pgsql-bugs
Hello.
I think I may have found a bug in the CREATE USER MAPPING / DROP SERVER
handling.
It is possible to create a user mapping on a server and drop said server in
two concurrent transactions, and have both succeed.
This results in an orphan row in the pg_user_mapping table.
I would expect one of those transactions to fail.
This is more easily explained with the following example:
CREATE extension postgres_fdw;
CREATE server pg_server FOREIGN DATA WRAPPER postgres_fdw
-- SESSION 1
BEGIN;
CREATE USER MAPPING FOR postgres SERVER pg_server OPTIONS (user 'user');
-- SESSION 2
BEGIN;
DROP SERVER pg_server;
-- SESSION 1
COMMIT;
-- SESSION 2
COMMIT;
select umserver, s.oid from pg_user_mapping left join pg_foreign_server s on
s.oid = pg_user_mapping.umserver;
┌──────────┬─────┐
│ umserver │ oid │
├──────────┼─────┤
│62172 │ ¤ │
└──────────┴─────┘
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Concurrent CREATE USER MAPPING and DROP SERVER
2013-07-04 14:27 Concurrent CREATE USER MAPPING and DROP SERVER Ronan Dunklau <rdunklau@gmail.com>
@ 2013-07-04 15:03 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2013-07-04 15:03 UTC (permalink / raw)
To: Ronan Dunklau <rdunklau@gmail.com>; +Cc: pgsql-bugs
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
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2013-07-04 15:03 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-07-04 14:27 Concurrent CREATE USER MAPPING and DROP SERVER Ronan Dunklau <rdunklau@gmail.com>
2013-07-04 15:03 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox