-
Notifications
You must be signed in to change notification settings - Fork 620
Redshift alter column type no set #1912
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Redshift alter column type no set #1912
Conversation
src/dialect/mod.rs
Outdated
false | ||
} | ||
|
||
/// Returns true if the dialect supports `ALTER TABLE tbl ALTER COLUMN col SET DATA TYPE <type> USING <exp>` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Returns true if the dialect supports `ALTER TABLE tbl ALTER COLUMN col SET DATA TYPE <type> USING <exp>` | |
/// Returns true if the dialect supports the `USING` clause in an `ALTER COLUMN` statement. | |
/// Example: | |
/// ```sql | |
/// ALTER TABLE tbl ALTER COLUMN col SET DATA TYPE <type> USING <exp>` | |
/// ``` |
thinking something like this so that its a bit clearer which part of the statement the flag refers to?
src/dialect/mod.rs
Outdated
/// | ||
/// - [Redshift](https://docs.aws.amazon.com/redshift/latest/dg/r_ALTER_TABLE.html#r_ALTER_TABLE-synopsis) | ||
/// - [PostgreSQL](https://www.postgresql.org/docs/current/sql-altertable.html) | ||
fn supports_alter_column_type_without_set(&self) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure I followed that this flag is necessary, it looks like we would be able to accept either variant with or without the SET DATA
prefix? The error message of existing tests if I understood the PR description correctly we can change to match the new behavior I think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that is an option. I hesitated a bit because saw specific negative tests, and did not want to break anything.
src/ast/ddl.rs
Outdated
/// Whether the statement included the optional `SET DATA` keywords | ||
had_set: bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Whether the statement included the optional `SET DATA` keywords | |
had_set: bool, | |
/// Set to true if the statement includes the `SET DATA TYPE` keywords | |
set_data_type: bool, |
Expanded the support for
ALTER TABLE tbl ALTER COLUMN col TYPE <type>
to the Redshift dialect in addition to PostgreSQL. Generalized this option using thesupports_xxx
functions in the Dialect trait to maintain backwards compatibility with expected error messages in non-supporting dialects.Improved SQL output from Ast by introducing an option to determine if
SET DATA
appears before theTYPE
keyword.