Closed matthias-Q closed 1 year ago
t-sql also allows for adding a constraint without saying the word constraint
, so maybe the thing to do here is to have a general add
rule (and possibly the other verbs) that offers a choice between a seq of column definitions or a seq of constraint definitions?
Thanks, @dmfay for the suggestion. I will try this later today
@dmfay I have issues fixing the test alter.txt L428
ALTER TABLE IF EXISTS my_table
ADD COLUMN IF NOT EXISTS val4 DATE,
ALTER COLUMN val5 DROP NOT NULL, -- comment, ignore me!
RENAME COLUMN val6 TO val7,
DROP COLUMN IF EXISTS val8;
I have checked this statement in Postgres and Mysql and in both dialects it is not valid. The rename
is the issue. Is this a bug in our implementation, or is is valid in another dialect?
This is very confusing. When just running the alter table with only the renaming part, if works fine.
@dmfay I have issues fixing the test alter.txt L428
ALTER TABLE IF EXISTS my_table ADD COLUMN IF NOT EXISTS val4 DATE, ALTER COLUMN val5 DROP NOT NULL, -- comment, ignore me! RENAME COLUMN val6 TO val7, DROP COLUMN IF EXISTS val8;
I have checked this statement in Postgres and Mysql and in both dialects it is not valid. The
rename
is the issue. Is this a bug in our implementation, or is is valid in another dialect?This is very confusing. When just running the alter table with only the renaming part, if works fine.
It looks like that was added here along with enabling more combinations of actions under alter table
for Postgres, but you're right, Postgres' alter table
allows column renames only as a single action. I don't know if any other dialects do allow it as one of multiple actions.
Closed by #175
Closes #135
This is an attempt to allow for multiple
alter table
add
statements, as it is supported by T-SQL.This does not work at the moment. I need a right precedence on the repeated section for at the
add_column
node, but this breaks the_alter_specification
one hierarchy level up. I have currently not solution for this problem. @DerekStride, do you have an idea? The issue is that there can be multiple_alter_specification
that are separated by commas, same as the_inner_add_column
node that I have added.Reference: https://learn.microsoft.com/de-de/sql/t-sql/statements/alter-table-transact-sql?view=sql-server-ver16