-
Notifications
You must be signed in to change notification settings - Fork 312
Description
When a column type change is recognised by sqlmesh, it runs a command like this in the database
/* SQLMESH_PLAN: 12345asdf */ ALTER TABLE "my_catalog"."my_schema"."my_schema__my_table__12345678" ALTER COLUMN "my_column" TYPE VARCHAR(355)
However in Redshift, "alter table alter column" commands are not allowed within a transaction (see documentation: https://docs.aws.amazon.com/redshift/latest/dg/r_ALTER_TABLE.html), so the query errors with
ALTER TABLE ALTER COLUMN cannot run inside a transaction block
Note that sqlmesh only logs that the transaction is aborted, and not which tables or columns are causing the issue.
sqlmesh.utils.errors.PlanError: {'S': 'ERROR', 'C': '25P02', 'M': 'current transaction is aborted, commands ignored until end of transaction block', 'F': '/opt/brazil-pkg-cache/packages/RedshiftPADB/RedshiftPADB-1.0.48169.0/AL2_aarch64/generic-flavor/src/src/pg/src/backend/tcop/postgres.c', 'L': '4515', 'R': 'exec_parse_message'}
Expected behaviour: These commands should be executed outside of a transaction. Or until this is possible, the required manual changes should be logged in the sqlmesh plan before failing to allow users to make the changes in one go before retrying