Skip to content

Commit a34f6a3

Browse files
authored
fix: revoke split (#459)
1 parent c323eb0 commit a34f6a3

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

crates/pgt_statement_splitter/src/lib.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,29 @@ mod tests {
149149
}
150150
}
151151

152+
#[test]
153+
fn revoke() {
154+
Tester::from("revoke delete on table \"public\".\"voice_call\" from \"anon\";")
155+
.expect_statements(vec![
156+
"revoke delete on table \"public\".\"voice_call\" from \"anon\";",
157+
]);
158+
159+
Tester::from("revoke select on table \"public\".\"voice_call\" from \"anon\";")
160+
.expect_statements(vec![
161+
"revoke select on table \"public\".\"voice_call\" from \"anon\";",
162+
]);
163+
164+
Tester::from("revoke update on table \"public\".\"voice_call\" from \"anon\";")
165+
.expect_statements(vec![
166+
"revoke update on table \"public\".\"voice_call\" from \"anon\";",
167+
]);
168+
169+
Tester::from("revoke insert on table \"public\".\"voice_call\" from \"anon\";")
170+
.expect_statements(vec![
171+
"revoke insert on table \"public\".\"voice_call\" from \"anon\";",
172+
]);
173+
}
174+
152175
#[test]
153176
fn double_newlines() {
154177
Tester::from("select 1 from contact\n\nselect 1\n\nselect 3").expect_statements(vec![

crates/pgt_statement_splitter/src/splitter/common.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ pub(crate) fn unknown(p: &mut Splitter, exclude: &[SyntaxKind]) {
183183
SyntaxKind::EXCEPT_KW,
184184
// for grant
185185
SyntaxKind::GRANT_KW,
186+
// for revoke
187+
SyntaxKind::REVOKE_KW,
186188
SyntaxKind::COMMA,
187189
]
188190
.iter()
@@ -215,6 +217,8 @@ pub(crate) fn unknown(p: &mut Splitter, exclude: &[SyntaxKind]) {
215217
SyntaxKind::INSTEAD_KW,
216218
// for grant
217219
SyntaxKind::GRANT_KW,
220+
// for revoke
221+
SyntaxKind::REVOKE_KW,
218222
SyntaxKind::COMMA,
219223
// Do update in INSERT stmt
220224
SyntaxKind::DO_KW,

0 commit comments

Comments
 (0)