Skip to content

Commit

Permalink
BREAKING! AlterViewStmt.actions now contains ListExpr
Browse files Browse the repository at this point in the history
Properly expecting multiple ALTER VIEW actions to be comma-separated.
  • Loading branch information
nene committed Jan 31, 2024
1 parent f493e16 commit 4ab708d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/cst/View.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,5 @@ export interface AlterViewStmt extends BaseNode {
ifExistsKw?: [Keyword<"IF">, Keyword<"EXISTS">];
name: EntityName;
columns?: ParenExpr<ListExpr<Identifier>>;
actions: (AlterViewAction | AsClause<SubSelect>)[];
actions: ListExpr<AlterViewAction | AsClause<SubSelect>>;
}
5 changes: 3 additions & 2 deletions src/parser.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -1858,7 +1858,7 @@ alter_view_stmt
ifKw:(__ if_exists)?
name:(__ entity_name)
cols:(__ paren$list$column)?
actions:(__ alter_view_action)+ {
actions:(__ list$alter_view_action) {
return loc({
type: "alter_view_stmt",
alterKw,
Expand All @@ -1867,7 +1867,7 @@ alter_view_stmt
ifExistsKw: read(ifKw),
name: read(name),
columns: read(cols),
actions: actions.map(read),
actions: read(actions),
});
}

Expand Down Expand Up @@ -6109,6 +6109,7 @@ list$alias$func_call = .
list$alias$paren$list$column = .
list$alias$relation_expr = .
list$alter_action = .
list$alter_view_action = .
list$column = .
list$column_assignment = .
list$column_definition = .
Expand Down
8 changes: 8 additions & 0 deletions test/ddl/view.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,14 @@ describe("view", () => {
testWc(`ALTER MATERIALIZED VIEW my_view ${action}`);
}

it("supports multiple alter-actions", () => {
testWc(`
ALTER MATERIALIZED VIEW my_view
CLUSTER ON my_index,
SET TABLESPACE foo
`);
});

it("supports SET TABLESPACE", () => {
testAlterMatWc("SET TABLESPACE foo");
testAlterMatWc("SET TABLESPACE foo NOWAIT");
Expand Down

0 comments on commit 4ab708d

Please sign in to comment.