Skip to content

Commit 5ac6cff

Browse files
authored
fix(pglt_statement_splitter): alter column split (#199)
* chore: rename crates to pglt_ * fix: rename codegen stuff to pglt * fix: var name * fix: lint-fix * fix: splitter for alter column
1 parent 9d0951c commit 5ac6cff

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

crates/pglt_analyser/src/lint/safety/ban_drop_column.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ declare_lint_rule! {
1212
///
1313
/// ### Invalid
1414
///
15-
/// ```sql,ignore
15+
/// ```sql,expect_diagnostic
1616
/// alter table test drop column id;
1717
/// ```
1818
///

crates/pglt_analyser/src/lint/safety/ban_drop_not_null.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ declare_lint_rule! {
1212
///
1313
/// ### Invalid
1414
///
15-
/// ```sql,ignore
15+
/// ```sql,expect_diagnostic
1616
/// alter table users alter column email drop not null;
1717
/// ```
1818
pub BanDropNotNull {

crates/pglt_statement_splitter/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,12 @@ mod tests {
104104
]);
105105
}
106106

107+
#[test]
108+
fn alter_column() {
109+
Tester::from("alter table users alter column email drop not null;")
110+
.expect_statements(vec!["alter table users alter column email drop not null;"]);
111+
}
112+
107113
#[test]
108114
fn insert_expect_error() {
109115
Tester::from("\ninsert select 1\n\nselect 3")

crates/pglt_statement_splitter/src/parser/ddl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ pub(crate) fn create(p: &mut Parser) {
1111
pub(crate) fn alter(p: &mut Parser) {
1212
p.expect(SyntaxKind::Alter);
1313

14-
unknown(p, &[]);
14+
unknown(p, &[SyntaxKind::Alter]);
1515
}

0 commit comments

Comments
 (0)