@@ -3190,12 +3190,25 @@ PreventTransactionChain(bool isTopLevel, const char *stmtType)
3190
3190
}
3191
3191
3192
3192
/*
3193
- * These two functions allow for warnings or errors if a command is
3194
- * executed outside of a transaction block.
3193
+ * WarnNoTranactionChain
3194
+ * RequireTransactionChain
3195
+ *
3196
+ * These two functions allow for warnings or errors if a command is executed
3197
+ * outside of a transaction block. This is useful for commands that have no
3198
+ * effects that persist past transaction end (and so calling them outside a
3199
+ * transaction block is presumably an error). DECLARE CURSOR is an example.
3200
+ * While top-level transaction control commands (BEGIN/COMMIT/ABORT) and SET
3201
+ * that have no effect issue warnings, all other no-effect commands generate
3202
+ * errors.
3203
+ *
3204
+ * If we appear to be running inside a user-defined function, we do not
3205
+ * issue anything, since the function could issue more commands that make
3206
+ * use of the current statement's results. Likewise subtransactions.
3207
+ * Thus these are inverses for PreventTransactionChain.
3195
3208
*
3196
- * While top-level transaction control commands (BEGIN/COMMIT/ABORT) and
3197
- * SET that have no effect issue warnings, all other no-effect commands
3198
- * generate errors .
3209
+ * isTopLevel: passed down from ProcessUtility to determine whether we are
3210
+ * inside a function.
3211
+ * stmtType: statement type name, for warning or error messages .
3199
3212
*/
3200
3213
void
3201
3214
WarnNoTransactionChain (bool isTopLevel , const char * stmtType )
@@ -3210,21 +3223,7 @@ RequireTransactionChain(bool isTopLevel, const char *stmtType)
3210
3223
}
3211
3224
3212
3225
/*
3213
- * RequireTransactionChain
3214
- *
3215
- * This routine is to be called by statements that must run inside
3216
- * a transaction block, because they have no effects that persist past
3217
- * transaction end (and so calling them outside a transaction block
3218
- * is presumably an error). DECLARE CURSOR is an example.
3219
- *
3220
- * If we appear to be running inside a user-defined function, we do not
3221
- * issue anything, since the function could issue more commands that make
3222
- * use of the current statement's results. Likewise subtransactions.
3223
- * Thus this is an inverse for PreventTransactionChain.
3224
- *
3225
- * isTopLevel: passed down from ProcessUtility to determine whether we are
3226
- * inside a function.
3227
- * stmtType: statement type name, for warning or error messages.
3226
+ * This is the implementation of the above two.
3228
3227
*/
3229
3228
static void
3230
3229
CheckTransactionChain (bool isTopLevel , bool throwError , const char * stmtType )
0 commit comments