diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2022-11-09 11:08:52 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2022-11-09 11:08:52 -0500 |
commit | 17e9ecac011832959b703b1d6a14788f9c8c829c (patch) | |
tree | c564c6b39efcf690ab6e6e30dcd48342bdc9cf1a /src | |
parent | edb4ef48d85542ff5fefd9eada998f40f06d3c83 (diff) | |
download | postgresql-17e9ecac011832959b703b1d6a14788f9c8c829c.tar.gz postgresql-17e9ecac011832959b703b1d6a14788f9c8c829c.zip |
Doc: add comments about PreventInTransactionBlock/IsInTransactionBlock.
Add a little to the header comments for these functions to make it
clearer what guarantees about commit behavior are provided to callers.
(See commit f92944137 for context.)
Although this is only a comment change, it's really documentation
aimed at authors of extensions, so it seems appropriate to back-patch.
Yugo Nagata and Tom Lane, per further discussion of bug #17434.
Discussion: https://postgr.es/m/17434-d9f7a064ce2a88a3@postgresql.org
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/access/transam/xact.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c index fa32231e39f..d578f11c4df 100644 --- a/src/backend/access/transam/xact.c +++ b/src/backend/access/transam/xact.c @@ -3338,6 +3338,10 @@ AbortCurrentTransaction(void) * a transaction block, typically because they have non-rollback-able * side effects or do internal commits. * + * If this routine completes successfully, then the calling statement is + * guaranteed that if it completes without error, its results will be + * committed immediately. + * * If we have already started a transaction block, issue an error; also issue * an error if we appear to be running inside a user-defined function (which * could issue more commands and possibly cause a failure after the statement @@ -3464,6 +3468,10 @@ CheckTransactionBlock(bool isTopLevel, bool throwError, const char *stmtType) * a transaction block than when running as single commands. ANALYZE is * currently the only example. * + * If this routine returns "false", then the calling statement is + * guaranteed that if it completes without error, its results will be + * committed immediately. + * * isTopLevel: passed down from ProcessUtility to determine whether we are * inside a function. */ |