Commit 04700b68 authored by Peter Eisentraut's avatar Peter Eisentraut

Rename TransactionChain functions

We call this thing a "transaction block" everywhere except in a few
functions, where it is mysteriously called a "transaction chain".  In
the SQL standard, a transaction chain is something different.  So rename
these functions to match the common terminology.
Reviewed-by: default avatarAlvaro Herrera <alvherre@alvh.no-ip.org>
parent 8d47a908
...@@ -310,7 +310,7 @@ static void CallSubXactCallbacks(SubXactEvent event, ...@@ -310,7 +310,7 @@ static void CallSubXactCallbacks(SubXactEvent event,
SubTransactionId mySubid, SubTransactionId mySubid,
SubTransactionId parentSubid); SubTransactionId parentSubid);
static void CleanupTransaction(void); static void CleanupTransaction(void);
static void CheckTransactionChain(bool isTopLevel, bool throwError, static void CheckTransactionBlock(bool isTopLevel, bool throwError,
const char *stmtType); const char *stmtType);
static void CommitTransaction(void); static void CommitTransaction(void);
static TransactionId RecordTransactionAbort(bool isSubXact); static TransactionId RecordTransactionAbort(bool isSubXact);
...@@ -3134,7 +3134,7 @@ AbortCurrentTransaction(void) ...@@ -3134,7 +3134,7 @@ AbortCurrentTransaction(void)
} }
/* /*
* PreventTransactionChain * PreventInTransactionBlock
* *
* This routine is to be called by statements that must not run inside * This routine is to be called by statements that must not run inside
* a transaction block, typically because they have non-rollback-able * a transaction block, typically because they have non-rollback-able
...@@ -3151,7 +3151,7 @@ AbortCurrentTransaction(void) ...@@ -3151,7 +3151,7 @@ AbortCurrentTransaction(void)
* stmtType: statement type name, for error messages. * stmtType: statement type name, for error messages.
*/ */
void void
PreventTransactionChain(bool isTopLevel, const char *stmtType) PreventInTransactionBlock(bool isTopLevel, const char *stmtType)
{ {
/* /*
* xact block already started? * xact block already started?
...@@ -3190,8 +3190,8 @@ PreventTransactionChain(bool isTopLevel, const char *stmtType) ...@@ -3190,8 +3190,8 @@ PreventTransactionChain(bool isTopLevel, const char *stmtType)
} }
/* /*
* WarnNoTranactionChain * WarnNoTranactionBlock
* RequireTransactionChain * RequireTransactionBlock
* *
* These two functions allow for warnings or errors if a command is executed * These two functions allow for warnings or errors if a command is executed
* outside of a transaction block. This is useful for commands that have no * outside of a transaction block. This is useful for commands that have no
...@@ -3204,29 +3204,29 @@ PreventTransactionChain(bool isTopLevel, const char *stmtType) ...@@ -3204,29 +3204,29 @@ PreventTransactionChain(bool isTopLevel, const char *stmtType)
* If we appear to be running inside a user-defined function, we do not * If we appear to be running inside a user-defined function, we do not
* issue anything, since the function could issue more commands that make * issue anything, since the function could issue more commands that make
* use of the current statement's results. Likewise subtransactions. * use of the current statement's results. Likewise subtransactions.
* Thus these are inverses for PreventTransactionChain. * Thus these are inverses for PreventInTransactionBlock.
* *
* isTopLevel: passed down from ProcessUtility to determine whether we are * isTopLevel: passed down from ProcessUtility to determine whether we are
* inside a function. * inside a function.
* stmtType: statement type name, for warning or error messages. * stmtType: statement type name, for warning or error messages.
*/ */
void void
WarnNoTransactionChain(bool isTopLevel, const char *stmtType) WarnNoTransactionBlock(bool isTopLevel, const char *stmtType)
{ {
CheckTransactionChain(isTopLevel, false, stmtType); CheckTransactionBlock(isTopLevel, false, stmtType);
} }
void void
RequireTransactionChain(bool isTopLevel, const char *stmtType) RequireTransactionBlock(bool isTopLevel, const char *stmtType)
{ {
CheckTransactionChain(isTopLevel, true, stmtType); CheckTransactionBlock(isTopLevel, true, stmtType);
} }
/* /*
* This is the implementation of the above two. * This is the implementation of the above two.
*/ */
static void static void
CheckTransactionChain(bool isTopLevel, bool throwError, const char *stmtType) CheckTransactionBlock(bool isTopLevel, bool throwError, const char *stmtType)
{ {
/* /*
* xact block already started? * xact block already started?
...@@ -3255,7 +3255,7 @@ CheckTransactionChain(bool isTopLevel, bool throwError, const char *stmtType) ...@@ -3255,7 +3255,7 @@ CheckTransactionChain(bool isTopLevel, bool throwError, const char *stmtType)
} }
/* /*
* IsInTransactionChain * IsInTransactionBlock
* *
* This routine is for statements that need to behave differently inside * This routine is for statements that need to behave differently inside
* a transaction block than when running as single commands. ANALYZE is * a transaction block than when running as single commands. ANALYZE is
...@@ -3265,10 +3265,10 @@ CheckTransactionChain(bool isTopLevel, bool throwError, const char *stmtType) ...@@ -3265,10 +3265,10 @@ CheckTransactionChain(bool isTopLevel, bool throwError, const char *stmtType)
* inside a function. * inside a function.
*/ */
bool bool
IsInTransactionChain(bool isTopLevel) IsInTransactionBlock(bool isTopLevel)
{ {
/* /*
* Return true on same conditions that would make PreventTransactionChain * Return true on same conditions that would make PreventInTransactionBlock
* error out * error out
*/ */
if (IsTransactionBlock()) if (IsTransactionBlock())
......
...@@ -202,7 +202,7 @@ cluster(ClusterStmt *stmt, bool isTopLevel) ...@@ -202,7 +202,7 @@ cluster(ClusterStmt *stmt, bool isTopLevel)
* We cannot run this form of CLUSTER inside a user transaction block; * We cannot run this form of CLUSTER inside a user transaction block;
* we'd be holding locks way too long. * we'd be holding locks way too long.
*/ */
PreventTransactionChain(isTopLevel, "CLUSTER"); PreventInTransactionBlock(isTopLevel, "CLUSTER");
/* /*
* Create special memory context for cross-transaction storage. * Create special memory context for cross-transaction storage.
......
...@@ -1476,7 +1476,7 @@ AlterDatabase(ParseState *pstate, AlterDatabaseStmt *stmt, bool isTopLevel) ...@@ -1476,7 +1476,7 @@ AlterDatabase(ParseState *pstate, AlterDatabaseStmt *stmt, bool isTopLevel)
dtablespace->defname), dtablespace->defname),
parser_errposition(pstate, dtablespace->location))); parser_errposition(pstate, dtablespace->location)));
/* this case isn't allowed within a transaction block */ /* this case isn't allowed within a transaction block */
PreventTransactionChain(isTopLevel, "ALTER DATABASE SET TABLESPACE"); PreventInTransactionBlock(isTopLevel, "ALTER DATABASE SET TABLESPACE");
movedb(stmt->dbname, defGetString(dtablespace)); movedb(stmt->dbname, defGetString(dtablespace));
return InvalidOid; return InvalidOid;
} }
......
...@@ -63,7 +63,7 @@ DiscardAll(bool isTopLevel) ...@@ -63,7 +63,7 @@ DiscardAll(bool isTopLevel)
* DISCARD ALL inside a transaction block would leave the transaction * DISCARD ALL inside a transaction block would leave the transaction
* still uncommitted. * still uncommitted.
*/ */
PreventTransactionChain(isTopLevel, "DISCARD ALL"); PreventInTransactionBlock(isTopLevel, "DISCARD ALL");
/* Closing portals might run user-defined code, so do that first. */ /* Closing portals might run user-defined code, so do that first. */
PortalHashTableDeleteAll(); PortalHashTableDeleteAll();
......
...@@ -63,7 +63,7 @@ PerformCursorOpen(DeclareCursorStmt *cstmt, ParamListInfo params, ...@@ -63,7 +63,7 @@ PerformCursorOpen(DeclareCursorStmt *cstmt, ParamListInfo params,
* user-visible effect). * user-visible effect).
*/ */
if (!(cstmt->options & CURSOR_OPT_HOLD)) if (!(cstmt->options & CURSOR_OPT_HOLD))
RequireTransactionChain(isTopLevel, "DECLARE CURSOR"); RequireTransactionBlock(isTopLevel, "DECLARE CURSOR");
/* /*
* Parse analysis was done already, but we still have to run the rule * Parse analysis was done already, but we still have to run the rule
......
...@@ -339,7 +339,7 @@ CreateSubscription(CreateSubscriptionStmt *stmt, bool isTopLevel) ...@@ -339,7 +339,7 @@ CreateSubscription(CreateSubscriptionStmt *stmt, bool isTopLevel)
* replication slot. * replication slot.
*/ */
if (create_slot) if (create_slot)
PreventTransactionChain(isTopLevel, "CREATE SUBSCRIPTION ... WITH (create_slot = true)"); PreventInTransactionBlock(isTopLevel, "CREATE SUBSCRIPTION ... WITH (create_slot = true)");
if (!superuser()) if (!superuser())
ereport(ERROR, ereport(ERROR,
...@@ -897,7 +897,7 @@ DropSubscription(DropSubscriptionStmt *stmt, bool isTopLevel) ...@@ -897,7 +897,7 @@ DropSubscription(DropSubscriptionStmt *stmt, bool isTopLevel)
* don't have the proper facilities for that. * don't have the proper facilities for that.
*/ */
if (slotname) if (slotname)
PreventTransactionChain(isTopLevel, "DROP SUBSCRIPTION"); PreventInTransactionBlock(isTopLevel, "DROP SUBSCRIPTION");
ObjectAddressSet(myself, SubscriptionRelationId, subid); ObjectAddressSet(myself, SubscriptionRelationId, subid);
......
...@@ -1321,7 +1321,7 @@ AlterEnum(AlterEnumStmt *stmt, bool isTopLevel) ...@@ -1321,7 +1321,7 @@ AlterEnum(AlterEnumStmt *stmt, bool isTopLevel)
!(tup->t_data->t_infomask & HEAP_UPDATED)) !(tup->t_data->t_infomask & HEAP_UPDATED))
/* safe to do inside transaction block */ ; /* safe to do inside transaction block */ ;
else else
PreventTransactionChain(isTopLevel, "ALTER TYPE ... ADD"); PreventInTransactionBlock(isTopLevel, "ALTER TYPE ... ADD");
AddEnumLabel(enum_type_oid, stmt->newVal, AddEnumLabel(enum_type_oid, stmt->newVal,
stmt->newValNeighbor, stmt->newValIsAfter, stmt->newValNeighbor, stmt->newValIsAfter,
......
...@@ -186,11 +186,11 @@ vacuum(int options, List *relations, VacuumParams *params, ...@@ -186,11 +186,11 @@ vacuum(int options, List *relations, VacuumParams *params,
*/ */
if (options & VACOPT_VACUUM) if (options & VACOPT_VACUUM)
{ {
PreventTransactionChain(isTopLevel, stmttype); PreventInTransactionBlock(isTopLevel, stmttype);
in_outer_xact = false; in_outer_xact = false;
} }
else else
in_outer_xact = IsInTransactionChain(isTopLevel); in_outer_xact = IsInTransactionBlock(isTopLevel);
/* /*
* Due to static variables vac_context, anl_context and vac_strategy, * Due to static variables vac_context, anl_context and vac_strategy,
......
...@@ -1516,7 +1516,7 @@ exec_replication_command(const char *cmd_string) ...@@ -1516,7 +1516,7 @@ exec_replication_command(const char *cmd_string)
break; break;
case T_BaseBackupCmd: case T_BaseBackupCmd:
PreventTransactionChain(true, "BASE_BACKUP"); PreventInTransactionBlock(true, "BASE_BACKUP");
SendBaseBackup((BaseBackupCmd *) cmd_node); SendBaseBackup((BaseBackupCmd *) cmd_node);
break; break;
...@@ -1532,7 +1532,7 @@ exec_replication_command(const char *cmd_string) ...@@ -1532,7 +1532,7 @@ exec_replication_command(const char *cmd_string)
{ {
StartReplicationCmd *cmd = (StartReplicationCmd *) cmd_node; StartReplicationCmd *cmd = (StartReplicationCmd *) cmd_node;
PreventTransactionChain(true, "START_REPLICATION"); PreventInTransactionBlock(true, "START_REPLICATION");
if (cmd->kind == REPLICATION_KIND_PHYSICAL) if (cmd->kind == REPLICATION_KIND_PHYSICAL)
StartReplication(cmd); StartReplication(cmd);
...@@ -1542,7 +1542,7 @@ exec_replication_command(const char *cmd_string) ...@@ -1542,7 +1542,7 @@ exec_replication_command(const char *cmd_string)
} }
case T_TimeLineHistoryCmd: case T_TimeLineHistoryCmd:
PreventTransactionChain(true, "TIMELINE_HISTORY"); PreventInTransactionBlock(true, "TIMELINE_HISTORY");
SendTimeLineHistory((TimeLineHistoryCmd *) cmd_node); SendTimeLineHistory((TimeLineHistoryCmd *) cmd_node);
break; break;
......
...@@ -453,13 +453,13 @@ standard_ProcessUtility(PlannedStmt *pstmt, ...@@ -453,13 +453,13 @@ standard_ProcessUtility(PlannedStmt *pstmt,
break; break;
case TRANS_STMT_COMMIT_PREPARED: case TRANS_STMT_COMMIT_PREPARED:
PreventTransactionChain(isTopLevel, "COMMIT PREPARED"); PreventInTransactionBlock(isTopLevel, "COMMIT PREPARED");
PreventCommandDuringRecovery("COMMIT PREPARED"); PreventCommandDuringRecovery("COMMIT PREPARED");
FinishPreparedTransaction(stmt->gid, true); FinishPreparedTransaction(stmt->gid, true);
break; break;
case TRANS_STMT_ROLLBACK_PREPARED: case TRANS_STMT_ROLLBACK_PREPARED:
PreventTransactionChain(isTopLevel, "ROLLBACK PREPARED"); PreventInTransactionBlock(isTopLevel, "ROLLBACK PREPARED");
PreventCommandDuringRecovery("ROLLBACK PREPARED"); PreventCommandDuringRecovery("ROLLBACK PREPARED");
FinishPreparedTransaction(stmt->gid, false); FinishPreparedTransaction(stmt->gid, false);
break; break;
...@@ -473,7 +473,7 @@ standard_ProcessUtility(PlannedStmt *pstmt, ...@@ -473,7 +473,7 @@ standard_ProcessUtility(PlannedStmt *pstmt,
ListCell *cell; ListCell *cell;
char *name = NULL; char *name = NULL;
RequireTransactionChain(isTopLevel, "SAVEPOINT"); RequireTransactionBlock(isTopLevel, "SAVEPOINT");
foreach(cell, stmt->options) foreach(cell, stmt->options)
{ {
...@@ -490,12 +490,12 @@ standard_ProcessUtility(PlannedStmt *pstmt, ...@@ -490,12 +490,12 @@ standard_ProcessUtility(PlannedStmt *pstmt,
break; break;
case TRANS_STMT_RELEASE: case TRANS_STMT_RELEASE:
RequireTransactionChain(isTopLevel, "RELEASE SAVEPOINT"); RequireTransactionBlock(isTopLevel, "RELEASE SAVEPOINT");
ReleaseSavepoint(stmt->options); ReleaseSavepoint(stmt->options);
break; break;
case TRANS_STMT_ROLLBACK_TO: case TRANS_STMT_ROLLBACK_TO:
RequireTransactionChain(isTopLevel, "ROLLBACK TO SAVEPOINT"); RequireTransactionBlock(isTopLevel, "ROLLBACK TO SAVEPOINT");
RollbackToSavepoint(stmt->options); RollbackToSavepoint(stmt->options);
/* /*
...@@ -536,13 +536,13 @@ standard_ProcessUtility(PlannedStmt *pstmt, ...@@ -536,13 +536,13 @@ standard_ProcessUtility(PlannedStmt *pstmt,
case T_CreateTableSpaceStmt: case T_CreateTableSpaceStmt:
/* no event triggers for global objects */ /* no event triggers for global objects */
PreventTransactionChain(isTopLevel, "CREATE TABLESPACE"); PreventInTransactionBlock(isTopLevel, "CREATE TABLESPACE");
CreateTableSpace((CreateTableSpaceStmt *) parsetree); CreateTableSpace((CreateTableSpaceStmt *) parsetree);
break; break;
case T_DropTableSpaceStmt: case T_DropTableSpaceStmt:
/* no event triggers for global objects */ /* no event triggers for global objects */
PreventTransactionChain(isTopLevel, "DROP TABLESPACE"); PreventInTransactionBlock(isTopLevel, "DROP TABLESPACE");
DropTableSpace((DropTableSpaceStmt *) parsetree); DropTableSpace((DropTableSpaceStmt *) parsetree);
break; break;
...@@ -592,7 +592,7 @@ standard_ProcessUtility(PlannedStmt *pstmt, ...@@ -592,7 +592,7 @@ standard_ProcessUtility(PlannedStmt *pstmt,
case T_CreatedbStmt: case T_CreatedbStmt:
/* no event triggers for global objects */ /* no event triggers for global objects */
PreventTransactionChain(isTopLevel, "CREATE DATABASE"); PreventInTransactionBlock(isTopLevel, "CREATE DATABASE");
createdb(pstate, (CreatedbStmt *) parsetree); createdb(pstate, (CreatedbStmt *) parsetree);
break; break;
...@@ -611,7 +611,7 @@ standard_ProcessUtility(PlannedStmt *pstmt, ...@@ -611,7 +611,7 @@ standard_ProcessUtility(PlannedStmt *pstmt,
DropdbStmt *stmt = (DropdbStmt *) parsetree; DropdbStmt *stmt = (DropdbStmt *) parsetree;
/* no event triggers for global objects */ /* no event triggers for global objects */
PreventTransactionChain(isTopLevel, "DROP DATABASE"); PreventInTransactionBlock(isTopLevel, "DROP DATABASE");
dropdb(stmt->dbname, stmt->missing_ok); dropdb(stmt->dbname, stmt->missing_ok);
} }
break; break;
...@@ -690,7 +690,7 @@ standard_ProcessUtility(PlannedStmt *pstmt, ...@@ -690,7 +690,7 @@ standard_ProcessUtility(PlannedStmt *pstmt,
break; break;
case T_AlterSystemStmt: case T_AlterSystemStmt:
PreventTransactionChain(isTopLevel, "ALTER SYSTEM"); PreventInTransactionBlock(isTopLevel, "ALTER SYSTEM");
AlterSystemSetConfigFile((AlterSystemStmt *) parsetree); AlterSystemSetConfigFile((AlterSystemStmt *) parsetree);
break; break;
...@@ -756,13 +756,13 @@ standard_ProcessUtility(PlannedStmt *pstmt, ...@@ -756,13 +756,13 @@ standard_ProcessUtility(PlannedStmt *pstmt,
* Since the lock would just get dropped immediately, LOCK TABLE * Since the lock would just get dropped immediately, LOCK TABLE
* outside a transaction block is presumed to be user error. * outside a transaction block is presumed to be user error.
*/ */
RequireTransactionChain(isTopLevel, "LOCK TABLE"); RequireTransactionBlock(isTopLevel, "LOCK TABLE");
/* forbidden in parallel mode due to CommandIsReadOnly */ /* forbidden in parallel mode due to CommandIsReadOnly */
LockTableCommand((LockStmt *) parsetree); LockTableCommand((LockStmt *) parsetree);
break; break;
case T_ConstraintsSetStmt: case T_ConstraintsSetStmt:
WarnNoTransactionChain(isTopLevel, "SET CONSTRAINTS"); WarnNoTransactionBlock(isTopLevel, "SET CONSTRAINTS");
AfterTriggerSetState((ConstraintsSetStmt *) parsetree); AfterTriggerSetState((ConstraintsSetStmt *) parsetree);
break; break;
...@@ -808,7 +808,7 @@ standard_ProcessUtility(PlannedStmt *pstmt, ...@@ -808,7 +808,7 @@ standard_ProcessUtility(PlannedStmt *pstmt,
* start-transaction-command calls would not have the * start-transaction-command calls would not have the
* intended effect! * intended effect!
*/ */
PreventTransactionChain(isTopLevel, PreventInTransactionBlock(isTopLevel,
(stmt->kind == REINDEX_OBJECT_SCHEMA) ? "REINDEX SCHEMA" : (stmt->kind == REINDEX_OBJECT_SCHEMA) ? "REINDEX SCHEMA" :
(stmt->kind == REINDEX_OBJECT_SYSTEM) ? "REINDEX SYSTEM" : (stmt->kind == REINDEX_OBJECT_SYSTEM) ? "REINDEX SYSTEM" :
"REINDEX DATABASE"); "REINDEX DATABASE");
...@@ -1307,7 +1307,7 @@ ProcessUtilitySlow(ParseState *pstate, ...@@ -1307,7 +1307,7 @@ ProcessUtilitySlow(ParseState *pstate,
List *inheritors = NIL; List *inheritors = NIL;
if (stmt->concurrent) if (stmt->concurrent)
PreventTransactionChain(isTopLevel, PreventInTransactionBlock(isTopLevel,
"CREATE INDEX CONCURRENTLY"); "CREATE INDEX CONCURRENTLY");
/* /*
...@@ -1715,7 +1715,7 @@ ExecDropStmt(DropStmt *stmt, bool isTopLevel) ...@@ -1715,7 +1715,7 @@ ExecDropStmt(DropStmt *stmt, bool isTopLevel)
{ {
case OBJECT_INDEX: case OBJECT_INDEX:
if (stmt->concurrent) if (stmt->concurrent)
PreventTransactionChain(isTopLevel, PreventInTransactionBlock(isTopLevel,
"DROP INDEX CONCURRENTLY"); "DROP INDEX CONCURRENTLY");
/* fall through */ /* fall through */
......
...@@ -7348,7 +7348,7 @@ ExecSetVariableStmt(VariableSetStmt *stmt, bool isTopLevel) ...@@ -7348,7 +7348,7 @@ ExecSetVariableStmt(VariableSetStmt *stmt, bool isTopLevel)
case VAR_SET_VALUE: case VAR_SET_VALUE:
case VAR_SET_CURRENT: case VAR_SET_CURRENT:
if (stmt->is_local) if (stmt->is_local)
WarnNoTransactionChain(isTopLevel, "SET LOCAL"); WarnNoTransactionBlock(isTopLevel, "SET LOCAL");
(void) set_config_option(stmt->name, (void) set_config_option(stmt->name,
ExtractSetVariableArgs(stmt), ExtractSetVariableArgs(stmt),
(superuser() ? PGC_SUSET : PGC_USERSET), (superuser() ? PGC_SUSET : PGC_USERSET),
...@@ -7368,7 +7368,7 @@ ExecSetVariableStmt(VariableSetStmt *stmt, bool isTopLevel) ...@@ -7368,7 +7368,7 @@ ExecSetVariableStmt(VariableSetStmt *stmt, bool isTopLevel)
{ {
ListCell *head; ListCell *head;
WarnNoTransactionChain(isTopLevel, "SET TRANSACTION"); WarnNoTransactionBlock(isTopLevel, "SET TRANSACTION");
foreach(head, stmt->args) foreach(head, stmt->args)
{ {
...@@ -7419,7 +7419,7 @@ ExecSetVariableStmt(VariableSetStmt *stmt, bool isTopLevel) ...@@ -7419,7 +7419,7 @@ ExecSetVariableStmt(VariableSetStmt *stmt, bool isTopLevel)
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("SET LOCAL TRANSACTION SNAPSHOT is not implemented"))); errmsg("SET LOCAL TRANSACTION SNAPSHOT is not implemented")));
WarnNoTransactionChain(isTopLevel, "SET TRANSACTION"); WarnNoTransactionBlock(isTopLevel, "SET TRANSACTION");
Assert(nodeTag(&con->val) == T_String); Assert(nodeTag(&con->val) == T_String);
ImportSnapshot(strVal(&con->val)); ImportSnapshot(strVal(&con->val));
} }
...@@ -7429,11 +7429,11 @@ ExecSetVariableStmt(VariableSetStmt *stmt, bool isTopLevel) ...@@ -7429,11 +7429,11 @@ ExecSetVariableStmt(VariableSetStmt *stmt, bool isTopLevel)
break; break;
case VAR_SET_DEFAULT: case VAR_SET_DEFAULT:
if (stmt->is_local) if (stmt->is_local)
WarnNoTransactionChain(isTopLevel, "SET LOCAL"); WarnNoTransactionBlock(isTopLevel, "SET LOCAL");
/* fall through */ /* fall through */
case VAR_RESET: case VAR_RESET:
if (strcmp(stmt->name, "transaction_isolation") == 0) if (strcmp(stmt->name, "transaction_isolation") == 0)
WarnNoTransactionChain(isTopLevel, "RESET TRANSACTION"); WarnNoTransactionBlock(isTopLevel, "RESET TRANSACTION");
(void) set_config_option(stmt->name, (void) set_config_option(stmt->name,
NULL, NULL,
......
...@@ -1171,7 +1171,7 @@ ExportSnapshot(Snapshot snapshot) ...@@ -1171,7 +1171,7 @@ ExportSnapshot(Snapshot snapshot)
char pathtmp[MAXPGPATH]; char pathtmp[MAXPGPATH];
/* /*
* It's tempting to call RequireTransactionChain here, since it's not very * It's tempting to call RequireTransactionBlock here, since it's not very
* useful to export a snapshot that will disappear immediately afterwards. * useful to export a snapshot that will disappear immediately afterwards.
* However, we haven't got enough information to do that, since we don't * However, we haven't got enough information to do that, since we don't
* know if we're at top level or not. For example, we could be inside a * know if we're at top level or not. For example, we could be inside a
......
...@@ -2047,7 +2047,7 @@ command_no_begin(const char *query) ...@@ -2047,7 +2047,7 @@ command_no_begin(const char *query)
/* /*
* Commands not allowed within transactions. The statements checked for * Commands not allowed within transactions. The statements checked for
* here should be exactly those that call PreventTransactionChain() in the * here should be exactly those that call PreventInTransactionBlock() in the
* backend. * backend.
*/ */
if (wordlen == 6 && pg_strncasecmp(query, "vacuum", 6) == 0) if (wordlen == 6 && pg_strncasecmp(query, "vacuum", 6) == 0)
......
...@@ -369,10 +369,10 @@ extern bool IsTransactionBlock(void); ...@@ -369,10 +369,10 @@ extern bool IsTransactionBlock(void);
extern bool IsTransactionOrTransactionBlock(void); extern bool IsTransactionOrTransactionBlock(void);
extern char TransactionBlockStatusCode(void); extern char TransactionBlockStatusCode(void);
extern void AbortOutOfAnyTransaction(void); extern void AbortOutOfAnyTransaction(void);
extern void PreventTransactionChain(bool isTopLevel, const char *stmtType); extern void PreventInTransactionBlock(bool isTopLevel, const char *stmtType);
extern void RequireTransactionChain(bool isTopLevel, const char *stmtType); extern void RequireTransactionBlock(bool isTopLevel, const char *stmtType);
extern void WarnNoTransactionChain(bool isTopLevel, const char *stmtType); extern void WarnNoTransactionBlock(bool isTopLevel, const char *stmtType);
extern bool IsInTransactionChain(bool isTopLevel); extern bool IsInTransactionBlock(bool isTopLevel);
extern void RegisterXactCallback(XactCallback callback, void *arg); extern void RegisterXactCallback(XactCallback callback, void *arg);
extern void UnregisterXactCallback(XactCallback callback, void *arg); extern void UnregisterXactCallback(XactCallback callback, void *arg);
extern void RegisterSubXactCallback(SubXactCallback callback, void *arg); extern void RegisterSubXactCallback(SubXactCallback callback, void *arg);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment