-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #113 from pert5432/support-truncate
- Loading branch information
Showing
9 changed files
with
328 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 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 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,11 @@ | ||
TRUNCATE users CONTINUE IDENTITY RESTRICT; | ||
|
||
TRUNCATE TABLE users RESTART IDENTITY CASCADE; | ||
|
||
TRUNCATE users; | ||
|
||
TRUNCATE accounts CASCADE; | ||
|
||
TRUNCATE accounts RESTRICT; | ||
|
||
TRUNCATE TABLE users; |
50 changes: 50 additions & 0 deletions
50
crates/parser/tests/snapshots/statements/valid/0057@1.snap
This file contains 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,50 @@ | ||
--- | ||
source: crates/parser/tests/statement_parser_test.rs | ||
assertion_line: 62 | ||
description: TRUNCATE users CONTINUE IDENTITY RESTRICT; | ||
--- | ||
Parse { | ||
cst: SourceFile@0..42 | ||
TruncateStmt@0..42 | ||
Truncate@0..8 "TRUNCATE" | ||
Whitespace@8..9 " " | ||
RangeVar@9..14 | ||
Ident@9..14 "users" | ||
Whitespace@14..15 " " | ||
ContinueP@15..23 "CONTINUE" | ||
Whitespace@23..24 " " | ||
IdentityP@24..32 "IDENTITY" | ||
Whitespace@32..33 " " | ||
Restrict@33..41 "RESTRICT" | ||
Ascii59@41..42 ";" | ||
, | ||
errors: [], | ||
stmts: [ | ||
RawStmt { | ||
stmt: TruncateStmt( | ||
TruncateStmt { | ||
relations: [ | ||
Node { | ||
node: Some( | ||
RangeVar( | ||
RangeVar { | ||
catalogname: "", | ||
schemaname: "", | ||
relname: "users", | ||
inh: true, | ||
relpersistence: "p", | ||
alias: None, | ||
location: 9, | ||
}, | ||
), | ||
), | ||
}, | ||
], | ||
restart_seqs: false, | ||
behavior: DropRestrict, | ||
}, | ||
), | ||
range: 0..41, | ||
}, | ||
], | ||
} |
52 changes: 52 additions & 0 deletions
52
crates/parser/tests/snapshots/statements/valid/0057@2.snap
This file contains 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,52 @@ | ||
--- | ||
source: crates/parser/tests/statement_parser_test.rs | ||
assertion_line: 62 | ||
description: TRUNCATE TABLE users RESTART IDENTITY CASCADE; | ||
--- | ||
Parse { | ||
cst: SourceFile@0..46 | ||
TruncateStmt@0..46 | ||
Truncate@0..8 "TRUNCATE" | ||
Whitespace@8..9 " " | ||
Table@9..14 "TABLE" | ||
Whitespace@14..15 " " | ||
RangeVar@15..20 | ||
Ident@15..20 "users" | ||
Whitespace@20..21 " " | ||
Restart@21..28 "RESTART" | ||
Whitespace@28..29 " " | ||
IdentityP@29..37 "IDENTITY" | ||
Whitespace@37..38 " " | ||
Cascade@38..45 "CASCADE" | ||
Ascii59@45..46 ";" | ||
, | ||
errors: [], | ||
stmts: [ | ||
RawStmt { | ||
stmt: TruncateStmt( | ||
TruncateStmt { | ||
relations: [ | ||
Node { | ||
node: Some( | ||
RangeVar( | ||
RangeVar { | ||
catalogname: "", | ||
schemaname: "", | ||
relname: "users", | ||
inh: true, | ||
relpersistence: "p", | ||
alias: None, | ||
location: 15, | ||
}, | ||
), | ||
), | ||
}, | ||
], | ||
restart_seqs: true, | ||
behavior: DropCascade, | ||
}, | ||
), | ||
range: 0..45, | ||
}, | ||
], | ||
} |
44 changes: 44 additions & 0 deletions
44
crates/parser/tests/snapshots/statements/valid/0057@3.snap
This file contains 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,44 @@ | ||
--- | ||
source: crates/parser/tests/statement_parser_test.rs | ||
assertion_line: 62 | ||
description: TRUNCATE users; | ||
--- | ||
Parse { | ||
cst: SourceFile@0..15 | ||
TruncateStmt@0..15 | ||
Truncate@0..8 "TRUNCATE" | ||
Whitespace@8..9 " " | ||
RangeVar@9..14 | ||
Ident@9..14 "users" | ||
Ascii59@14..15 ";" | ||
, | ||
errors: [], | ||
stmts: [ | ||
RawStmt { | ||
stmt: TruncateStmt( | ||
TruncateStmt { | ||
relations: [ | ||
Node { | ||
node: Some( | ||
RangeVar( | ||
RangeVar { | ||
catalogname: "", | ||
schemaname: "", | ||
relname: "users", | ||
inh: true, | ||
relpersistence: "p", | ||
alias: None, | ||
location: 9, | ||
}, | ||
), | ||
), | ||
}, | ||
], | ||
restart_seqs: false, | ||
behavior: DropRestrict, | ||
}, | ||
), | ||
range: 0..14, | ||
}, | ||
], | ||
} |
46 changes: 46 additions & 0 deletions
46
crates/parser/tests/snapshots/statements/valid/0057@4.snap
This file contains 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,46 @@ | ||
--- | ||
source: crates/parser/tests/statement_parser_test.rs | ||
assertion_line: 62 | ||
description: TRUNCATE accounts CASCADE; | ||
--- | ||
Parse { | ||
cst: SourceFile@0..26 | ||
TruncateStmt@0..26 | ||
Truncate@0..8 "TRUNCATE" | ||
Whitespace@8..9 " " | ||
RangeVar@9..17 | ||
Ident@9..17 "accounts" | ||
Whitespace@17..18 " " | ||
Cascade@18..25 "CASCADE" | ||
Ascii59@25..26 ";" | ||
, | ||
errors: [], | ||
stmts: [ | ||
RawStmt { | ||
stmt: TruncateStmt( | ||
TruncateStmt { | ||
relations: [ | ||
Node { | ||
node: Some( | ||
RangeVar( | ||
RangeVar { | ||
catalogname: "", | ||
schemaname: "", | ||
relname: "accounts", | ||
inh: true, | ||
relpersistence: "p", | ||
alias: None, | ||
location: 9, | ||
}, | ||
), | ||
), | ||
}, | ||
], | ||
restart_seqs: false, | ||
behavior: DropCascade, | ||
}, | ||
), | ||
range: 0..25, | ||
}, | ||
], | ||
} |
46 changes: 46 additions & 0 deletions
46
crates/parser/tests/snapshots/statements/valid/0057@5.snap
This file contains 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,46 @@ | ||
--- | ||
source: crates/parser/tests/statement_parser_test.rs | ||
assertion_line: 62 | ||
description: TRUNCATE accounts RESTRICT; | ||
--- | ||
Parse { | ||
cst: SourceFile@0..27 | ||
TruncateStmt@0..27 | ||
Truncate@0..8 "TRUNCATE" | ||
Whitespace@8..9 " " | ||
RangeVar@9..17 | ||
Ident@9..17 "accounts" | ||
Whitespace@17..18 " " | ||
Restrict@18..26 "RESTRICT" | ||
Ascii59@26..27 ";" | ||
, | ||
errors: [], | ||
stmts: [ | ||
RawStmt { | ||
stmt: TruncateStmt( | ||
TruncateStmt { | ||
relations: [ | ||
Node { | ||
node: Some( | ||
RangeVar( | ||
RangeVar { | ||
catalogname: "", | ||
schemaname: "", | ||
relname: "accounts", | ||
inh: true, | ||
relpersistence: "p", | ||
alias: None, | ||
location: 9, | ||
}, | ||
), | ||
), | ||
}, | ||
], | ||
restart_seqs: false, | ||
behavior: DropRestrict, | ||
}, | ||
), | ||
range: 0..26, | ||
}, | ||
], | ||
} |
46 changes: 46 additions & 0 deletions
46
crates/parser/tests/snapshots/statements/valid/0057@6.snap
This file contains 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,46 @@ | ||
--- | ||
source: crates/parser/tests/statement_parser_test.rs | ||
assertion_line: 62 | ||
description: TRUNCATE TABLE users; | ||
--- | ||
Parse { | ||
cst: SourceFile@0..21 | ||
TruncateStmt@0..21 | ||
Truncate@0..8 "TRUNCATE" | ||
Whitespace@8..9 " " | ||
Table@9..14 "TABLE" | ||
Whitespace@14..15 " " | ||
RangeVar@15..20 | ||
Ident@15..20 "users" | ||
Ascii59@20..21 ";" | ||
, | ||
errors: [], | ||
stmts: [ | ||
RawStmt { | ||
stmt: TruncateStmt( | ||
TruncateStmt { | ||
relations: [ | ||
Node { | ||
node: Some( | ||
RangeVar( | ||
RangeVar { | ||
catalogname: "", | ||
schemaname: "", | ||
relname: "users", | ||
inh: true, | ||
relpersistence: "p", | ||
alias: None, | ||
location: 15, | ||
}, | ||
), | ||
), | ||
}, | ||
], | ||
restart_seqs: false, | ||
behavior: DropRestrict, | ||
}, | ||
), | ||
range: 0..20, | ||
}, | ||
], | ||
} |