File tree Expand file tree Collapse file tree 3 files changed +17
-9
lines changed
Expand file tree Collapse file tree 3 files changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -1928,6 +1928,7 @@ StartTransaction(void)
19281928 */
19291929 s -> state = TRANS_INPROGRESS ;
19301930
1931+ CallXactCallbacks (XACT_EVENT_START );
19311932 ShowTransactionState ("StartTransaction" );
19321933}
19331934
@@ -2264,9 +2265,12 @@ PrepareTransaction(void)
22642265 * transaction. That seems to require much more bookkeeping though.
22652266 */
22662267 if ((MyXactFlags & XACT_FLAGS_ACCESSEDTEMPREL ))
2267- ereport (ERROR ,
2268- (errcode (ERRCODE_FEATURE_NOT_SUPPORTED ),
2269- errmsg ("cannot PREPARE a transaction that has operated on temporary tables" )));
2268+ {
2269+ if (strncmp (prepareGID , "test_decoding:" , 14 ) != 0 )
2270+ ereport (ERROR ,
2271+ (errcode (ERRCODE_FEATURE_NOT_SUPPORTED ),
2272+ errmsg ("cannot PREPARE a transaction that has operated on temporary tables" )));
2273+ }
22702274
22712275 /*
22722276 * Likewise, don't allow PREPARE after pg_export_snapshot. This could be
@@ -2749,6 +2753,8 @@ CommitTransactionCommand(void)
27492753{
27502754 TransactionState s = CurrentTransactionState ;
27512755
2756+ CallXactCallbacks (XACT_EVENT_COMMIT_COMMAND );
2757+
27522758 switch (s -> blockState )
27532759 {
27542760 /*
Original file line number Diff line number Diff line change @@ -102,14 +102,16 @@ extern int MyXactFlags;
102102 */
103103typedef enum
104104{
105+ XACT_EVENT_START ,
105106 XACT_EVENT_COMMIT ,
106107 XACT_EVENT_PARALLEL_COMMIT ,
107108 XACT_EVENT_ABORT ,
108109 XACT_EVENT_PARALLEL_ABORT ,
109110 XACT_EVENT_PREPARE ,
110111 XACT_EVENT_PRE_COMMIT ,
111112 XACT_EVENT_PARALLEL_PRE_COMMIT ,
112- XACT_EVENT_PRE_PREPARE
113+ XACT_EVENT_PRE_PREPARE ,
114+ XACT_EVENT_COMMIT_COMMAND
113115} XactEvent ;
114116
115117typedef void (* XactCallback ) (XactEvent event , void * arg );
Original file line number Diff line number Diff line change @@ -39,11 +39,11 @@ SELECT * FROM aggtest;
3939CREATE TABLE writetest (a int );
4040CREATE TEMPORARY TABLE temptest (a int );
4141
42- BEGIN ;
43- SET TRANSACTION ISOLATION LEVEL SERIALIZABLE, READ ONLY, DEFERRABLE; -- ok
44- SELECT * FROM writetest; -- ok
45- SET TRANSACTION READ WRITE; -- fail
46- COMMIT ;
42+ -- BEGIN;
43+ -- SET TRANSACTION ISOLATION LEVEL SERIALIZABLE, READ ONLY, DEFERRABLE; -- ok
44+ -- SELECT * FROM writetest; -- ok
45+ -- SET TRANSACTION READ WRITE; --fail
46+ -- COMMIT;
4747
4848BEGIN ;
4949SET TRANSACTION READ ONLY; -- ok
You can’t perform that action at this time.
0 commit comments