Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions crates/pgt_statement_splitter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,22 @@ mod tests {
Tester::from("/* this is a test */\nselect 1").expect_statements(vec!["select 1"]);
}

#[test]
fn trigger_instead_of() {
Tester::from(
"CREATE OR REPLACE TRIGGER my_trigger
INSTEAD OF INSERT ON my_table
FOR EACH ROW
EXECUTE FUNCTION my_table_trigger_fn();",
)
.expect_statements(vec![
"CREATE OR REPLACE TRIGGER my_trigger
INSTEAD OF INSERT ON my_table
FOR EACH ROW
EXECUTE FUNCTION my_table_trigger_fn();",
]);
}

#[test]
fn with_check() {
Tester::from("create policy employee_insert on journey_execution for insert to authenticated with check ((select private.organisation_id()) = organisation_id);")
Expand Down
2 changes: 2 additions & 0 deletions crates/pgt_statement_splitter/src/parser/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ pub(crate) fn unknown(p: &mut Parser, exclude: &[SyntaxKind]) {
SyntaxKind::For,
// e.g. on insert or delete
SyntaxKind::Or,
// e.g. INSTEAD OF INSERT
SyntaxKind::Of,
// for create rule
SyntaxKind::On,
// for create rule
Expand Down