From: Tom Lane Date: Tue, 13 Feb 2007 19:39:55 +0000 (+0000) Subject: Disallow committing a prepared transaction unless we are in the same database X-Git-Url: http://waps.l3s.uni-hannover.de/gitweb/?a=commitdiff_plain;h=ad3eb217aa7d700ad428b819a5eb658917569492;p=users%2Fbernd%2Fpostgres.git Disallow committing a prepared transaction unless we are in the same database it was executed in. Someday it might be nice to allow cross-DB commits, but work would be needed in NOTIFY and perhaps other places. Per Heikki. --- diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c index 79a321d38b..6fe57e0e06 100644 --- a/src/backend/access/transam/twophase.c +++ b/src/backend/access/transam/twophase.c @@ -390,6 +390,18 @@ LockGXact(const char *gid, Oid user) errmsg("permission denied to finish prepared transaction"), errhint("Must be superuser or the user that prepared the transaction."))); + /* + * Note: it probably would be possible to allow committing from another + * database; but at the moment NOTIFY is known not to work and there + * may be some other issues as well. Hence disallow until someone + * gets motivated to make it work. + */ + if (MyDatabaseId != gxact->proc.databaseId) + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("prepared transaction belongs to another database"), + errhint("Connect to the database where the transaction was prepared to finish it."))); + /* OK for me to lock it */ gxact->locking_xid = GetTopTransactionId();