Skip to content

Commit

Permalink
feat: Test ALTER TABLE with elided COLUMN keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoniePhiline committed Feb 3, 2023
1 parent a2533b2 commit bd25587
Showing 1 changed file with 70 additions and 1 deletion.
71 changes: 70 additions & 1 deletion test/corpus/alter.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,35 @@ ALTER TABLE my_table
(keyword_alter)
(keyword_table)
(table_reference name: (identifier))
(add_column (keyword_add) (keyword_column)
(add_column
(keyword_add)
(keyword_column)
(column_definition
name: (identifier)
type: (varchar
(keyword_varchar)
size: (literal))
(keyword_not)
(keyword_null))
))))

==================
Alter table and add column, eliding column keyword
==================

ALTER TABLE my_table
ADD val3 VARCHAR(100) NOT NULL;

---

(program
(statement
(alter_table
(keyword_alter)
(keyword_table)
(table_reference name: (identifier))
(add_column
(keyword_add)
(column_definition
name: (identifier)
type: (varchar
Expand Down Expand Up @@ -93,6 +121,28 @@ ALTER TABLE my_table
type: (varchar (keyword_varchar) size: (literal)))
)))

==================
Alter table and alter column changing type, eliding column keyword
==================

ALTER TABLE my_table
ALTER val3 TYPE VARCHAR(255);

---

(program
(statement
(alter_table
(keyword_alter)
(keyword_table)
(table_reference name: (identifier))
(alter_column
(keyword_alter)
name: (identifier)
(keyword_type)
type: (varchar (keyword_varchar) size: (literal)))
)))

==================
Alter table and alter column dropping not-null constraint
==================
Expand Down Expand Up @@ -137,6 +187,25 @@ ALTER TABLE my_table
name: (identifier))
)))

==================
Alter table and drop column, eliding column keyword
==================

ALTER TABLE my_table
DROP val3;

---

(program
(statement
(alter_table
(keyword_alter)
(keyword_table)
(table_reference name: (identifier))
(drop_column
(keyword_drop)
name: (identifier))
)))

==================
Alter table and rename column
Expand Down

0 comments on commit bd25587

Please sign in to comment.