File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed
crates/pglt_statement_splitter/src Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -142,6 +142,23 @@ mod tests {
142142 . expect_statements ( vec ! [ "select case when select 2 then 1 else 0 end" ] ) ;
143143 }
144144
145+ #[ test]
146+ fn create_trigger ( ) {
147+ Tester :: from ( "alter table appointment_status add constraint valid_key check (private.strip_special_chars(key) = key and length(key) > 0 and length(key) < 60);
148+
149+ create trigger default_key before insert on appointment_type for each row when (new.key is null) execute procedure default_key ();
150+
151+ create trigger default_key before insert on appointment_status for each row when (new.key is null) execute procedure default_key ();
152+
153+ alter table deal_type add column key text not null;
154+ " )
155+ . expect_statements ( vec ! [ "alter table appointment_status add constraint valid_key check (private.strip_special_chars(key) = key and length(key) > 0 and length(key) < 60);" ,
156+ "create trigger default_key before insert on appointment_type for each row when (new.key is null) execute procedure default_key ();" ,
157+ "create trigger default_key before insert on appointment_status for each row when (new.key is null) execute procedure default_key ();" ,
158+ "alter table deal_type add column key text not null;" ,
159+ ] ) ;
160+ }
161+
145162 #[ test]
146163 #[ timeout( 1000 ) ]
147164 fn simple_select ( ) {
Original file line number Diff line number Diff line change @@ -5,7 +5,15 @@ use super::{common::unknown, Parser};
55pub ( crate ) fn create ( p : & mut Parser ) {
66 p. expect ( SyntaxKind :: Create ) ;
77
8- unknown ( p, & [ ] ) ;
8+ unknown (
9+ p,
10+ & [
11+ SyntaxKind :: Insert ,
12+ SyntaxKind :: Update ,
13+ SyntaxKind :: DeleteP ,
14+ SyntaxKind :: Select ,
15+ ] ,
16+ ) ;
917}
1018
1119pub ( crate ) fn alter ( p : & mut Parser ) {
You can’t perform that action at this time.
0 commit comments