From: Pavan Deolasee Date: Tue, 16 Aug 2016 04:01:29 +0000 (+0530) Subject: Make sure ON COMMIT actions are invoked only when transaction is still valid X-Git-Tag: XL9_5_R1_3~3 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=97d9e5dc82c6764fcbeb92d16ccdbc09bac18f06;p=postgres-xl.git Make sure ON COMMIT actions are invoked only when transaction is still valid Per report by Agoston David --- diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index fe169f3585..024924e485 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -12396,6 +12396,16 @@ PreCommit_on_commit_actions(void) ListCell *l; List *oids_to_truncate = NIL; +#ifdef XCP + /* + * If we are being called outside a valid transaction, do nothing. This can + * only happen when the function gets called while we are still processing + * CommitTransaction/PrepareTransaction + */ + if (GetTopTransactionIdIfAny() == InvalidTransactionId) + return; +#endif + foreach(l, on_commits) { OnCommitItem *oc = (OnCommitItem *) lfirst(l);