1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-12 05:01:15 +03:00

Allow optional SAVEPOINT keyword in RELEASE and ROLLBACK TO, for greater

compliance with SQL2003 spec syntax.

Oliver Jowett
This commit is contained in:
Tom Lane
2004-08-12 19:12:21 +00:00
parent 10249abfa1
commit a583675108
8 changed files with 118 additions and 94 deletions

View File

@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.469 2004/08/02 04:26:35 tgl Exp $
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.470 2004/08/12 19:12:21 tgl Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -3982,6 +3982,14 @@ TransactionStmt:
(Node *)makeString($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)));
$$ = (Node *)n;
}
| RELEASE ColId
{
TransactionStmt *n = makeNode(TransactionStmt);
@@ -3990,12 +3998,20 @@ TransactionStmt:
(Node *)makeString($2)));
$$ = (Node *)n;
}
| ROLLBACK TO ColId
| 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($3)));
(Node *)makeString($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)));
$$ = (Node *)n;
}
;

View File

@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/tcop/utility.c,v 1.223 2004/08/02 01:30:45 tgl Exp $
* $PostgreSQL: pgsql/src/backend/tcop/utility.c,v 1.224 2004/08/12 19:12:21 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -388,12 +388,12 @@ ProcessUtility(Node *parsetree,
break;
case TRANS_STMT_RELEASE:
RequireTransactionChain((void *)stmt, "RELEASE");
RequireTransactionChain((void *)stmt, "RELEASE SAVEPOINT");
ReleaseSavepoint(stmt->options);
break;
case TRANS_STMT_ROLLBACK_TO:
RequireTransactionChain((void *)stmt, "ROLLBACK TO");
RequireTransactionChain((void *)stmt, "ROLLBACK TO SAVEPOINT");
RollbackToSavepoint(stmt->options);
/*
* CommitTransactionCommand is in charge