Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcaf2b64

Browse files
committed
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, butwork would be needed in NOTIFY and perhaps other places. Per Heikki.
1 parentcf4cc78 commitcaf2b64

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

‎src/backend/access/transam/twophase.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
*$PostgreSQL: pgsql/src/backend/access/transam/twophase.c,v 1.27 2007/01/16 13:28:56 alvherre Exp $
10+
*$PostgreSQL: pgsql/src/backend/access/transam/twophase.c,v 1.28 2007/02/13 19:39:42 tgl Exp $
1111
*
1212
* NOTES
1313
*Each global transaction is associated with a global transaction
@@ -393,6 +393,18 @@ LockGXact(const char *gid, Oid user)
393393
errmsg("permission denied to finish prepared transaction"),
394394
errhint("Must be superuser or the user that prepared the transaction.")));
395395

396+
/*
397+
* Note: it probably would be possible to allow committing from another
398+
* database; but at the moment NOTIFY is known not to work and there
399+
* may be some other issues as well. Hence disallow until someone
400+
* gets motivated to make it work.
401+
*/
402+
if (MyDatabaseId!=gxact->proc.databaseId)
403+
ereport(ERROR,
404+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
405+
errmsg("prepared transaction belongs to another database"),
406+
errhint("Connect to the database where the transaction was prepared to finish it.")));
407+
396408
/* OK for me to lock it */
397409
gxact->locking_xid=GetTopTransactionId();
398410

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp