mirror of
https://github.com/postgres/postgres.git
synced 2025-09-03 15:22:11 +03:00
Simplify parse representation of savepoint commands
Instead of embedding the savepoint name in a list and then requiring complex code to unpack it, just add another struct field to store it directly. Reviewed-by: Alvaro Herrera <alvherre@alvh.no-ip.org>
This commit is contained in:
@@ -469,34 +469,18 @@ standard_ProcessUtility(PlannedStmt *pstmt,
|
||||
break;
|
||||
|
||||
case TRANS_STMT_SAVEPOINT:
|
||||
{
|
||||
ListCell *cell;
|
||||
char *name = NULL;
|
||||
|
||||
RequireTransactionBlock(isTopLevel, "SAVEPOINT");
|
||||
|
||||
foreach(cell, stmt->options)
|
||||
{
|
||||
DefElem *elem = lfirst(cell);
|
||||
|
||||
if (strcmp(elem->defname, "savepoint_name") == 0)
|
||||
name = strVal(elem->arg);
|
||||
}
|
||||
|
||||
Assert(PointerIsValid(name));
|
||||
|
||||
DefineSavepoint(name);
|
||||
}
|
||||
RequireTransactionBlock(isTopLevel, "SAVEPOINT");
|
||||
DefineSavepoint(stmt->savepoint_name);
|
||||
break;
|
||||
|
||||
case TRANS_STMT_RELEASE:
|
||||
RequireTransactionBlock(isTopLevel, "RELEASE SAVEPOINT");
|
||||
ReleaseSavepoint(stmt->options);
|
||||
ReleaseSavepoint(stmt->savepoint_name);
|
||||
break;
|
||||
|
||||
case TRANS_STMT_ROLLBACK_TO:
|
||||
RequireTransactionBlock(isTopLevel, "ROLLBACK TO SAVEPOINT");
|
||||
RollbackToSavepoint(stmt->options);
|
||||
RollbackToSavepoint(stmt->savepoint_name);
|
||||
|
||||
/*
|
||||
* CommitTransactionCommand is in charge of
|
||||
|
Reference in New Issue
Block a user