1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-01 21:31:19 +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:
Peter Eisentraut
2018-02-16 20:57:06 -05:00
parent 04700b685f
commit ec87efde8d
7 changed files with 17 additions and 59 deletions

View File

@@ -9876,40 +9876,35 @@ TransactionStmt:
{
TransactionStmt *n = makeNode(TransactionStmt);
n->kind = TRANS_STMT_SAVEPOINT;
n->options = list_make1(makeDefElem("savepoint_name",
(Node *)makeString($2), @1));
n->savepoint_name = $2;
$$ = (Node *)n;
}
| RELEASE SAVEPOINT ColId
{
TransactionStmt *n = makeNode(TransactionStmt);
n->kind = TRANS_STMT_RELEASE;
n->options = list_make1(makeDefElem("savepoint_name",
(Node *)makeString($3), @1));
n->savepoint_name = $3;
$$ = (Node *)n;
}
| RELEASE ColId
{
TransactionStmt *n = makeNode(TransactionStmt);
n->kind = TRANS_STMT_RELEASE;
n->options = list_make1(makeDefElem("savepoint_name",
(Node *)makeString($2), @1));
n->savepoint_name = $2;
$$ = (Node *)n;
}
| ROLLBACK opt_transaction TO SAVEPOINT ColId
{
TransactionStmt *n = makeNode(TransactionStmt);
n->kind = TRANS_STMT_ROLLBACK_TO;
n->options = list_make1(makeDefElem("savepoint_name",
(Node *)makeString($5), @1));
n->savepoint_name = $5;
$$ = (Node *)n;
}
| ROLLBACK opt_transaction TO ColId
{
TransactionStmt *n = makeNode(TransactionStmt);
n->kind = TRANS_STMT_ROLLBACK_TO;
n->options = list_make1(makeDefElem("savepoint_name",
(Node *)makeString($4), @1));
n->savepoint_name = $4;
$$ = (Node *)n;
}
| PREPARE TRANSACTION Sconst