Skip to content

Commit 152cc15

Browse files
committed
PGPRO-2564: Add ATX compatibility check
1 parent 97e2365 commit 152cc15

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pg_variables.c

+11
Original file line numberDiff line numberDiff line change
@@ -2088,6 +2088,15 @@ processChanges(Action action)
20882088
}
20892089
}
20902090

2091+
static void
2092+
compatibility_check(void)
2093+
{
2094+
#ifdef PGPRO_EE
2095+
if (getNestLevelATX() != 0)
2096+
elog(ERROR, "pg_variable extension is not compatible with autonomous transactions and connection pooling");
2097+
#endif
2098+
}
2099+
20912100
/*
20922101
* Intercept execution during subtransaction processing
20932102
*/
@@ -2101,6 +2110,7 @@ pgvSubTransCallback(SubXactEvent event, SubTransactionId mySubid,
21012110
{
21022111
case SUBXACT_EVENT_START_SUB:
21032112
pushChangesStack();
2113+
compatibility_check();
21042114
break;
21052115
case SUBXACT_EVENT_COMMIT_SUB:
21062116
processChanges(RELEASE_SAVEPOINT);
@@ -2125,6 +2135,7 @@ pgvTransCallback(XactEvent event, void *arg)
21252135
switch (event)
21262136
{
21272137
case XACT_EVENT_PRE_COMMIT:
2138+
compatibility_check();
21282139
processChanges(RELEASE_SAVEPOINT);
21292140
break;
21302141
case XACT_EVENT_ABORT:

0 commit comments

Comments
 (0)