File tree Expand file tree Collapse file tree 8 files changed +247
-1
lines changed
snapshots/statements/valid Expand file tree Collapse file tree 8 files changed +247
-1
lines changed Original file line number Diff line number Diff line change @@ -954,6 +954,7 @@ fn custom_handlers(node: &Node) -> TokenStream {
954954 } ,
955955 "TruncateStmt" => quote ! {
956956 tokens. push( TokenProperty :: from( Token :: Truncate ) ) ;
957+ tokens. push( TokenProperty :: from( Token :: Table ) ) ;
957958 if n. restart_seqs {
958959 tokens. push( TokenProperty :: from( Token :: Restart ) ) ;
959960 tokens. push( TokenProperty :: from( Token :: IdentityP ) ) ;
Original file line number Diff line number Diff line change @@ -366,6 +366,7 @@ mod tests {
366366 SyntaxKind :: TruncateStmt ,
367367 vec ! [
368368 TokenProperty :: from( SyntaxKind :: Truncate ) ,
369+ TokenProperty :: from( SyntaxKind :: Table ) ,
369370 TokenProperty :: from( SyntaxKind :: ContinueP ) ,
370371 TokenProperty :: from( SyntaxKind :: IdentityP ) ,
371372 TokenProperty :: from( SyntaxKind :: Restrict ) ,
Original file line number Diff line number Diff line change 1- TRUNCATE users CONTINUE IDENTITY RESTRICT
1+ TRUNCATE users CONTINUE IDENTITY RESTRICT;
2+
3+ TRUNCATE TABLE users RESTART IDENTITY CASCADE;
4+
5+ TRUNCATE users;
6+
7+ TRUNCATE accounts CASCADE;
8+
9+ TRUNCATE accounts RESTRICT;
10+
11+ TRUNCATE TABLE users;
Original file line number Diff line number Diff line change 1+ -- -
2+ source : crates / parser / tests / statement_parser_test .rs
3+ assertion_line : 62
4+ description : TRUNCATE TABLE users RESTART IDENTITY CASCADE ;
5+ -- -
6+ Parse {
7+ cst : SourceFile @0..46
8+ TruncateStmt @0..46
9+ Truncate @0..8 " TRUNCATE"
10+ Whitespace @8..9 " "
11+ Table @9..14 " TABLE"
12+ Whitespace @14..15 " "
13+ RangeVar @15..20
14+ Ident @15..20 " users"
15+ Whitespace @20..21 " "
16+ Restart @21..28 " RESTART"
17+ Whitespace @28..29 " "
18+ IdentityP @29..37 " IDENTITY"
19+ Whitespace @37..38 " "
20+ Cascade @38..45 " CASCADE"
21+ Ascii59 @45..46 " ;"
22+ ,
23+ errors : [],
24+ stmts : [
25+ RawStmt {
26+ stmt: TruncateStmt (
27+ TruncateStmt {
28+ relations: [
29+ Node {
30+ node: Some (
31+ RangeVar (
32+ RangeVar {
33+ catalogname: " " ,
34+ schemaname: " " ,
35+ relname: " users" ,
36+ inh: true ,
37+ relpersistence: " p" ,
38+ alias: None ,
39+ location: 15 ,
40+ },
41+ ),
42+ ),
43+ },
44+ ],
45+ restart_seqs: true ,
46+ behavior: DropCascade ,
47+ },
48+ ),
49+ range: 0..45 ,
50+ },
51+ ],
52+ }
Original file line number Diff line number Diff line change 1+ -- -
2+ source : crates / parser / tests / statement_parser_test .rs
3+ assertion_line : 62
4+ description : TRUNCATE users ;
5+ -- -
6+ Parse {
7+ cst : SourceFile @0..15
8+ TruncateStmt @0..15
9+ Truncate @0..8 " TRUNCATE"
10+ Whitespace @8..9 " "
11+ RangeVar @9..14
12+ Ident @9..14 " users"
13+ Ascii59 @14..15 " ;"
14+ ,
15+ errors : [],
16+ stmts : [
17+ RawStmt {
18+ stmt: TruncateStmt (
19+ TruncateStmt {
20+ relations: [
21+ Node {
22+ node: Some (
23+ RangeVar (
24+ RangeVar {
25+ catalogname: " " ,
26+ schemaname: " " ,
27+ relname: " users" ,
28+ inh: true ,
29+ relpersistence: " p" ,
30+ alias: None ,
31+ location: 9 ,
32+ },
33+ ),
34+ ),
35+ },
36+ ],
37+ restart_seqs: false ,
38+ behavior: DropRestrict ,
39+ },
40+ ),
41+ range: 0..14 ,
42+ },
43+ ],
44+ }
Original file line number Diff line number Diff line change 1+ -- -
2+ source : crates / parser / tests / statement_parser_test .rs
3+ assertion_line : 62
4+ description : TRUNCATE accounts CASCADE ;
5+ -- -
6+ Parse {
7+ cst : SourceFile @0..26
8+ TruncateStmt @0..26
9+ Truncate @0..8 " TRUNCATE"
10+ Whitespace @8..9 " "
11+ RangeVar @9..17
12+ Ident @9..17 " accounts"
13+ Whitespace @17..18 " "
14+ Cascade @18..25 " CASCADE"
15+ Ascii59 @25..26 " ;"
16+ ,
17+ errors : [],
18+ stmts : [
19+ RawStmt {
20+ stmt: TruncateStmt (
21+ TruncateStmt {
22+ relations: [
23+ Node {
24+ node: Some (
25+ RangeVar (
26+ RangeVar {
27+ catalogname: " " ,
28+ schemaname: " " ,
29+ relname: " accounts" ,
30+ inh: true ,
31+ relpersistence: " p" ,
32+ alias: None ,
33+ location: 9 ,
34+ },
35+ ),
36+ ),
37+ },
38+ ],
39+ restart_seqs: false ,
40+ behavior: DropCascade ,
41+ },
42+ ),
43+ range: 0..25 ,
44+ },
45+ ],
46+ }
Original file line number Diff line number Diff line change 1+ -- -
2+ source : crates / parser / tests / statement_parser_test .rs
3+ assertion_line : 62
4+ description : TRUNCATE accounts RESTRICT ;
5+ -- -
6+ Parse {
7+ cst : SourceFile @0..27
8+ TruncateStmt @0..27
9+ Truncate @0..8 " TRUNCATE"
10+ Whitespace @8..9 " "
11+ RangeVar @9..17
12+ Ident @9..17 " accounts"
13+ Whitespace @17..18 " "
14+ Restrict @18..26 " RESTRICT"
15+ Ascii59 @26..27 " ;"
16+ ,
17+ errors : [],
18+ stmts : [
19+ RawStmt {
20+ stmt: TruncateStmt (
21+ TruncateStmt {
22+ relations: [
23+ Node {
24+ node: Some (
25+ RangeVar (
26+ RangeVar {
27+ catalogname: " " ,
28+ schemaname: " " ,
29+ relname: " accounts" ,
30+ inh: true ,
31+ relpersistence: " p" ,
32+ alias: None ,
33+ location: 9 ,
34+ },
35+ ),
36+ ),
37+ },
38+ ],
39+ restart_seqs: false ,
40+ behavior: DropRestrict ,
41+ },
42+ ),
43+ range: 0..26 ,
44+ },
45+ ],
46+ }
Original file line number Diff line number Diff line change 1+ -- -
2+ source : crates / parser / tests / statement_parser_test .rs
3+ assertion_line : 62
4+ description : TRUNCATE TABLE users ;
5+ -- -
6+ Parse {
7+ cst : SourceFile @0..21
8+ TruncateStmt @0..21
9+ Truncate @0..8 " TRUNCATE"
10+ Whitespace @8..9 " "
11+ Table @9..14 " TABLE"
12+ Whitespace @14..15 " "
13+ RangeVar @15..20
14+ Ident @15..20 " users"
15+ Ascii59 @20..21 " ;"
16+ ,
17+ errors : [],
18+ stmts : [
19+ RawStmt {
20+ stmt: TruncateStmt (
21+ TruncateStmt {
22+ relations: [
23+ Node {
24+ node: Some (
25+ RangeVar (
26+ RangeVar {
27+ catalogname: " " ,
28+ schemaname: " " ,
29+ relname: " users" ,
30+ inh: true ,
31+ relpersistence: " p" ,
32+ alias: None ,
33+ location: 15 ,
34+ },
35+ ),
36+ ),
37+ },
38+ ],
39+ restart_seqs: false ,
40+ behavior: DropRestrict ,
41+ },
42+ ),
43+ range: 0..20 ,
44+ },
45+ ],
46+ }
You can’t perform that action at this time.
0 commit comments