-
Notifications
You must be signed in to change notification settings - Fork 100
feat: support transaction begin
#116
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
Merged
+11,247
−1
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
[alias] | ||
snap = "insta test" | ||
xtask = "run --package xtask --" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
advisory_lock | ||
aggregates | ||
alter_generic | ||
alter_operator | ||
|
32 changes: 32 additions & 0 deletions
32
crates/parser/tests/snapshots/statements/valid/[email protected]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
source: crates/parser/tests/statement_parser_test.rs | ||
description: "--\n-- ADVISORY LOCKS\n--\n\nBEGIN;" | ||
--- | ||
Parse { | ||
cst: [email protected] | ||
[email protected] "--" | ||
[email protected] "\n" | ||
[email protected] "-- ADVISORY LOCKS" | ||
[email protected] "\n" | ||
[email protected] "--" | ||
[email protected] "\n\n" | ||
[email protected] | ||
[email protected] "BEGIN" | ||
[email protected] ";" | ||
, | ||
errors: [], | ||
stmts: [ | ||
RawStmt { | ||
stmt: TransactionStmt( | ||
TransactionStmt { | ||
kind: TransStmtBegin, | ||
options: [], | ||
savepoint_name: "", | ||
gid: "", | ||
chain: false, | ||
}, | ||
), | ||
range: 24..30, | ||
}, | ||
], | ||
} |
363 changes: 363 additions & 0 deletions
363
crates/parser/tests/snapshots/statements/valid/[email protected]
Large diffs are not rendered by default.
Oops, something went wrong.
487 changes: 487 additions & 0 deletions
487
crates/parser/tests/snapshots/statements/valid/[email protected]
Large diffs are not rendered by default.
Oops, something went wrong.
361 changes: 361 additions & 0 deletions
361
crates/parser/tests/snapshots/statements/valid/[email protected]
Large diffs are not rendered by default.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
crates/parser/tests/snapshots/statements/valid/[email protected]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
source: crates/parser/tests/statement_parser_test.rs | ||
description: ROLLBACK; | ||
--- | ||
Parse { | ||
cst: [email protected] | ||
[email protected] "ROLLBACK" | ||
[email protected] ";" | ||
, | ||
errors: [], | ||
stmts: [], | ||
} |
487 changes: 487 additions & 0 deletions
487
crates/parser/tests/snapshots/statements/valid/[email protected]
Large diffs are not rendered by default.
Oops, something went wrong.
683 changes: 683 additions & 0 deletions
683
crates/parser/tests/snapshots/statements/valid/[email protected]
Large diffs are not rendered by default.
Oops, something went wrong.
186 changes: 186 additions & 0 deletions
186
crates/parser/tests/snapshots/statements/valid/[email protected]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,186 @@ | ||
--- | ||
source: crates/parser/tests/statement_parser_test.rs | ||
description: "SELECT count(*) FROM pg_locks WHERE locktype = 'advisory';" | ||
--- | ||
Parse { | ||
cst: [email protected] | ||
[email protected] | ||
[email protected] "SELECT" | ||
[email protected] " " | ||
[email protected] | ||
[email protected] | ||
[email protected] "count" | ||
[email protected] "(" | ||
[email protected] "*" | ||
[email protected] ")" | ||
[email protected] " " | ||
[email protected] "FROM" | ||
[email protected] " " | ||
[email protected] | ||
[email protected] "pg_locks" | ||
[email protected] " " | ||
[email protected] "WHERE" | ||
[email protected] " " | ||
[email protected] | ||
[email protected] | ||
[email protected] "locktype" | ||
[email protected] " " | ||
[email protected] "=" | ||
[email protected] " " | ||
[email protected] | ||
[email protected] "'advisory'" | ||
[email protected] ";" | ||
, | ||
errors: [], | ||
stmts: [ | ||
RawStmt { | ||
stmt: SelectStmt( | ||
SelectStmt { | ||
distinct_clause: [], | ||
into_clause: None, | ||
target_list: [ | ||
Node { | ||
node: Some( | ||
ResTarget( | ||
ResTarget { | ||
name: "", | ||
indirection: [], | ||
val: Some( | ||
Node { | ||
node: Some( | ||
FuncCall( | ||
FuncCall { | ||
funcname: [ | ||
Node { | ||
node: Some( | ||
String( | ||
String { | ||
sval: "count", | ||
}, | ||
), | ||
), | ||
}, | ||
], | ||
args: [], | ||
agg_order: [], | ||
agg_filter: None, | ||
over: None, | ||
agg_within_group: false, | ||
agg_star: true, | ||
agg_distinct: false, | ||
func_variadic: false, | ||
funcformat: CoerceExplicitCall, | ||
location: 7, | ||
}, | ||
), | ||
), | ||
}, | ||
), | ||
location: 7, | ||
}, | ||
), | ||
), | ||
}, | ||
], | ||
from_clause: [ | ||
Node { | ||
node: Some( | ||
RangeVar( | ||
RangeVar { | ||
catalogname: "", | ||
schemaname: "", | ||
relname: "pg_locks", | ||
inh: true, | ||
relpersistence: "p", | ||
alias: None, | ||
location: 21, | ||
}, | ||
), | ||
), | ||
}, | ||
], | ||
where_clause: Some( | ||
Node { | ||
node: Some( | ||
AExpr( | ||
AExpr { | ||
kind: AexprOp, | ||
name: [ | ||
Node { | ||
node: Some( | ||
String( | ||
String { | ||
sval: "=", | ||
}, | ||
), | ||
), | ||
}, | ||
], | ||
lexpr: Some( | ||
Node { | ||
node: Some( | ||
ColumnRef( | ||
ColumnRef { | ||
fields: [ | ||
Node { | ||
node: Some( | ||
String( | ||
String { | ||
sval: "locktype", | ||
}, | ||
), | ||
), | ||
}, | ||
], | ||
location: 36, | ||
}, | ||
), | ||
), | ||
}, | ||
), | ||
rexpr: Some( | ||
Node { | ||
node: Some( | ||
AConst( | ||
AConst { | ||
isnull: false, | ||
location: 47, | ||
val: Some( | ||
Sval( | ||
String { | ||
sval: "advisory", | ||
}, | ||
), | ||
), | ||
}, | ||
), | ||
), | ||
}, | ||
), | ||
location: 45, | ||
}, | ||
), | ||
), | ||
}, | ||
), | ||
group_clause: [], | ||
group_distinct: false, | ||
having_clause: None, | ||
window_clause: [], | ||
values_lists: [], | ||
sort_clause: [], | ||
limit_offset: None, | ||
limit_count: None, | ||
limit_option: Default, | ||
locking_clause: [], | ||
with_clause: None, | ||
op: SetopNone, | ||
all: false, | ||
larg: None, | ||
rarg: None, | ||
}, | ||
), | ||
range: 0..57, | ||
}, | ||
], | ||
} |
26 changes: 26 additions & 0 deletions
26
crates/parser/tests/snapshots/statements/valid/[email protected]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
source: crates/parser/tests/statement_parser_test.rs | ||
description: BEGIN; | ||
--- | ||
Parse { | ||
cst: [email protected] | ||
[email protected] | ||
[email protected] "BEGIN" | ||
[email protected] ";" | ||
, | ||
errors: [], | ||
stmts: [ | ||
RawStmt { | ||
stmt: TransactionStmt( | ||
TransactionStmt { | ||
kind: TransStmtBegin, | ||
options: [], | ||
savepoint_name: "", | ||
gid: "", | ||
chain: false, | ||
}, | ||
), | ||
range: 0..5, | ||
}, | ||
], | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rollback
statement is not part of the ASThttps://www.postgresql.org/docs/current/parser-stage.html#PARSER-STAGE-TRANSFORMATION-PROCESS