File tree 2 files changed +17
-2
lines changed
crates/pgt_statement_splitter/src
2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -142,6 +142,12 @@ mod tests {
142
142
. expect_statements ( vec ! [ "insert into tbl (id) select 1" , "select 3" ] ) ;
143
143
}
144
144
145
+ #[ test]
146
+ fn with_cte ( ) {
147
+ Tester :: from ( "with test as (select 1 as id) select * from test;" )
148
+ . expect_statements ( vec ! [ "with test as (select 1 as id) select * from test;" ] ) ;
149
+ }
150
+
145
151
#[ test]
146
152
fn case ( ) {
147
153
Tester :: from ( "select case when select 2 then 1 else 0 end" )
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ use pgt_lexer::SyntaxKind;
2
2
3
3
use super :: {
4
4
Parser ,
5
- common:: { parenthesis, statement , unknown} ,
5
+ common:: { parenthesis, unknown} ,
6
6
} ;
7
7
8
8
pub ( crate ) fn cte ( p : & mut Parser ) {
@@ -18,7 +18,16 @@ pub(crate) fn cte(p: &mut Parser) {
18
18
}
19
19
}
20
20
21
- statement ( p) ;
21
+ unknown (
22
+ p,
23
+ & [
24
+ SyntaxKind :: Select ,
25
+ SyntaxKind :: Insert ,
26
+ SyntaxKind :: Update ,
27
+ SyntaxKind :: DeleteP ,
28
+ SyntaxKind :: Merge ,
29
+ ] ,
30
+ ) ;
22
31
}
23
32
24
33
pub ( crate ) fn select ( p : & mut Parser ) {
You can’t perform that action at this time.
0 commit comments