diff options
Diffstat (limited to 'src/backend/access')
-rw-r--r-- | src/backend/access/transam/xact.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c index 9a9724574be..e62286f9f98 100644 --- a/src/backend/access/transam/xact.c +++ b/src/backend/access/transam/xact.c @@ -570,6 +570,27 @@ GetCurrentSubTransactionId(void) return s->subTransactionId; } +/* + * SubTransactionIsActive + * + * Test if the specified subxact ID is still active. Note caller is + * responsible for checking whether this ID is relevant to the current xact. + */ +bool +SubTransactionIsActive(SubTransactionId subxid) +{ + TransactionState s; + + for (s = CurrentTransactionState; s != NULL; s = s->parent) + { + if (s->state == TRANS_ABORT) + continue; + if (s->subTransactionId == subxid) + return true; + } + return false; +} + /* * GetCurrentCommandId |