File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
crates/pgt_statement_splitter/src Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -142,6 +142,12 @@ mod tests {
142142 . expect_statements ( vec ! [ "insert into tbl (id) select 1" , "select 3" ] ) ;
143143 }
144144
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+
145151 #[ test]
146152 fn case ( ) {
147153 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;
22
33use super :: {
44 Parser ,
5- common:: { parenthesis, statement , unknown} ,
5+ common:: { parenthesis, unknown} ,
66} ;
77
88pub ( crate ) fn cte ( p : & mut Parser ) {
@@ -18,7 +18,16 @@ pub(crate) fn cte(p: &mut Parser) {
1818 }
1919 }
2020
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+ ) ;
2231}
2332
2433pub ( crate ) fn select ( p : & mut Parser ) {
You can’t perform that action at this time.
0 commit comments