Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: recognize ABORT statements for PostgreSQL #2479

Merged
merged 1 commit into from
Jun 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,16 @@
"examplePrerequisiteStatements": ["begin transaction"]
},
{
"name": "ROLLBACK [TRANSACTION | WORK] [AND NO CHAIN]",
"name": "{ROLLBACK | ABORT} [TRANSACTION | WORK] [AND NO CHAIN]",
"executorName": "ClientSideStatementNoParamExecutor",
"resultType": "NO_RESULT",
"statementType": "ROLLBACK",
"regex": "(?is)\\A\\s*(?:rollback)(?:\\s+transaction|\\s+work)?(?:\\s+and\\s+no\\s+chain)?\\s*\\z",
"regex": "(?is)\\A\\s*(?:rollback|abort)(?:\\s+transaction|\\s+work)?(?:\\s+and\\s+no\\s+chain)?\\s*\\z",
"method": "statementRollback",
"exampleStatements": ["rollback", "rollback transaction", "rollback work", "rollback and no chain", "rollback transaction and no chain", "rollback work and no chain"],
"exampleStatements": [
"rollback", "rollback transaction", "rollback work", "rollback and no chain", "rollback transaction and no chain", "rollback work and no chain",
"abort", "abort transaction", "abort work", "abort and no chain", "abort transaction and no chain", "abort work and no chain"
],
"examplePrerequisiteStatements": ["begin transaction"]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,22 @@ public void testClientSideStatementType() {
assertEquals(
ClientSideStatementType.ROLLBACK,
parser.parse(Statement.of("ROLLBACK TRANSACTION")).getClientSideStatementType());
if (dialect == Dialect.POSTGRESQL) {
assertEquals(
ClientSideStatementType.ROLLBACK,
parser.parse(Statement.of("ABORT")).getClientSideStatementType());
assertEquals(
ClientSideStatementType.ROLLBACK,
parser.parse(Statement.of("ABORT TRANSACTION")).getClientSideStatementType());
assertEquals(
ClientSideStatementType.ROLLBACK,
parser.parse(Statement.of("ABORT WORK")).getClientSideStatementType());
assertEquals(
ClientSideStatementType.ROLLBACK,
parser
.parse(Statement.of("ABORT TRANSACTION and no chain"))
.getClientSideStatementType());
}

for (ClientSideStatementImpl statement : parser.getClientSideStatements()) {
assertNotNull(
Expand Down
Loading