Forbid finishing a prepared transaction from another database

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Forbid finishing a prepared transaction from another database
Дата
Msg-id 45D20728.1090302@enterprisedb.com
обсуждение исходный текст
Ответы Re: Forbid finishing a prepared transaction from another database  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-patches
Here's a patch to:

Throw an error if you try to COMMIT/ROLLBACK PREPARED from a database
other than the one where the transaction was originally prepared.

This needs to be fixed because at least NOTIFY/LISTEN gets confused, and
sends the notification to the database where the commit is done, not the
database where the transaction ran originally. And there might be other
places that get confused as well.

It turned out to be even simpler than I imagined. :)

--
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com
Index: src/backend/access/transam/twophase.c
===================================================================
RCS file: /home/hlinnaka/pgcvsrepository/pgsql/src/backend/access/transam/twophase.c,v
retrieving revision 1.27
diff -c -r1.27 twophase.c
*** src/backend/access/transam/twophase.c    16 Jan 2007 13:28:56 -0000    1.27
--- src/backend/access/transam/twophase.c    13 Feb 2007 18:39:04 -0000
***************
*** 393,398 ****
--- 393,404 ----
                    errmsg("permission denied to finish prepared transaction"),
                       errhint("Must be superuser or the user that prepared the transaction.")));

+         if (MyProc->databaseId != gxact->proc.databaseId)
+             ereport(ERROR,
+                     (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+                   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();


В списке pgsql-patches по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [GENERAL] contrib/levenshtein() has a bug?
Следующее
От: Tom Dunstan
Дата:
Сообщение: Re: Enums patch v2