-
Notifications
You must be signed in to change notification settings - Fork 18
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
modifyDataType does not support running in a transaction in redshift #83
Comments
Update: Unexpected error running Liquibase: ERROR: ALTER TABLE ALTER COLUMN does not support USING expression [Failed SQL: (0) ALTER TABLE grandcare_datalake.rs_staging_como_devicemodels_latest ALTER COLUMN url TYPE VARCHAR(max) USING (url::VARCHAR(max))] |
Hello, I am having the same problem. Firstly:
Secondly:In redshift, it doesn't support the usual We should run something like this: -- Add a new column to the existing table with the correct type you want.
ALTER TABLE <table_name> ADD COLUMN <new_column_name> VARCHAR(100);
-- Then copy all the values from your target column into the new added column.
UPDATE <table_name> SET <new_column_name> = <column_name>;
-- Then drop the old column
ALTER TABLE <table_name> DROP COLUMN <column_name>;
-- Then rename the new column into the old column name
ALTER TABLE <table_name> RENAME COLUMN <new_column_name> TO <column_name>; However, when running this sequence of commands directly in redshift and then running ALTER TABLE <table_name> ALTER COLUMN <column_name> TYPE <new_data_type> USING (<column_name>::<new_data_type>); But Redshift doesn't accept either the |
I can confirm that this is still an issue for Liquibase version 4.25.1. Using We will be leaving this ticket open for the community to fix. If you want to submit a PR, our dev team will support and guide you through the process. Thank you, |
I’m trying to alter a column datatype in redshift using modifyDataType and running into this error:
Unexpected error running Liquibase: ERROR: ALTER TABLE ALTER COLUMN cannot run inside a transaction block [Failed SQL: (0)
See also forum thread:
https://forum.liquibase.org/t/modifydatatype-on-a-column-in-redshift/6627
The text was updated successfully, but these errors were encountered: