Skip to content

Commit

Permalink
Support ALTER INDEX ALTER COLUMN with column number
Browse files Browse the repository at this point in the history
Fixes #70
  • Loading branch information
nene committed Feb 10, 2024
1 parent a746d05 commit a69fb24
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/cst/AlterAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export interface AlterActionAlterColumn extends BaseNode {
type: "alter_action_alter_column";
alterKw: Keyword<"ALTER"> | [Keyword<"ALTER">, Keyword<"COLUMN">];
ifExistsKw?: [Keyword<"IF">, Keyword<"EXISTS">];
column: Identifier;
column: Identifier | NumberLiteral;
action: AlterColumnAction;
}

Expand Down
2 changes: 1 addition & 1 deletion src/parser.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -2751,7 +2751,7 @@ rename_column_kw
/ kw:RENAME (&sqlite / &postgres) { return kw; }

alter_action_alter_column
= alterKw:(alter_column_kw __) ifKw:(if_exists __)? column:(column __) action:alter_column_action {
= alterKw:(alter_column_kw __) ifKw:(if_exists __)? column:((column / number_literal) __) action:alter_column_action {
return loc({
type: "alter_action_alter_column",
alterKw: read(alterKw),
Expand Down
2 changes: 1 addition & 1 deletion test/ddl/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ describe("index", () => {
});

it("supports ALTER COLUMN .. SET STATISTICS", () => {
testWc("ALTER INDEX my_idx ALTER COLUMN col SET STATISTICS 100");
testWc("ALTER INDEX my_idx ALTER COLUMN 3 SET STATISTICS 100");
});

it("supports ALTER INDEX ALL IN TABLESPACE", () => {
Expand Down

0 comments on commit a69fb24

Please sign in to comment.