Skip to content

Commit

Permalink
add missing TransactionStmtKind::Start check for transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
bmbferreira committed Oct 1, 2024
1 parent 0019f41 commit fe3a965
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub fn ban_concurrent_index_creation_in_transaction(
for raw_stmt in tree {
match &raw_stmt.stmt {
Stmt::TransactionStmt(stmt) => {
if stmt.kind == TransactionStmtKind::Begin && !in_transaction {
if (stmt.kind == TransactionStmtKind::Begin || stmt.kind == TransactionStmtKind::Start) && !in_transaction {
in_transaction = true;
}
if stmt.kind == TransactionStmtKind::Commit {
Expand Down
2 changes: 1 addition & 1 deletion linter/src/rules/constraint_missing_not_valid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fn not_valid_validate_in_transaction(tree: &[RawStmt], assume_in_transaction: bo
for raw_stmt in tree {
match &raw_stmt.stmt {
Stmt::TransactionStmt(stmt) => {
if stmt.kind == TransactionStmtKind::Begin && !in_transaction {
if (stmt.kind == TransactionStmtKind::Begin || stmt.kind == TransactionStmtKind::Start) && !in_transaction {
in_transaction = true;
not_valid_names.clear();
}
Expand Down
2 changes: 1 addition & 1 deletion linter/src/rules/prefer_robust_stmts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub fn prefer_robust_stmts(
for raw_stmt in tree {
match &raw_stmt.stmt {
Stmt::TransactionStmt(stmt) => match stmt.kind {
TransactionStmtKind::Begin => inside_transaction = true,
TransactionStmtKind::Begin | TransactionStmtKind::Start => inside_transaction = true,
TransactionStmtKind::Commit => inside_transaction = false,
_ => continue,
},
Expand Down
2 changes: 1 addition & 1 deletion linter/src/rules/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub fn tables_created_in_transaction(
for raw_stmt in tree {
match &raw_stmt.stmt {
Stmt::TransactionStmt(stmt) => match stmt.kind {
TransactionStmtKind::Begin => inside_transaction = true,
TransactionStmtKind::Begin | TransactionStmtKind::Start => inside_transaction = true,
TransactionStmtKind::Commit => inside_transaction = false,
_ => continue,
},
Expand Down

0 comments on commit fe3a965

Please sign in to comment.