(redshift): upgrading from older CDK version caused This table is already SORTKEY AUTO
#26460
Labels
@aws-cdk/aws-redshift
Related to Amazon Redshift
bug
This issue is a bug.
effort/medium
Medium work item – several days of effort
p2
Describe the bug
In older version of the AWS CDK (pre
2.0.0-alpha.8
) setting the sort key was not supported and a created the table did not have an explicit sort key property. When #17135 introduced support for it, the Table Handler got changed to add anALTER TABLE tableName ALTER SORTKEY AUTO
statementwhen the sort key "changed" to AUTO. [1] Since previously the property was
undefined`, the property is detected as changed and the ALTER statement is attempted to be executed but will fail because Redshift has defaulted to create the table with SORTKEY AUTO.[1] https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/aws-redshift-alpha/lib/private/database-query-provider/table.ts?t=7#L177-L194
Expected Behavior
Handler should not fail in this scenario.
Current Behavior
Handler fails, resource rolls back.
Reproduction Steps
n/a
Possible Solution
Probably one of these three:
ALTER TABLE tableName SORTKEY AUTO
statement to not be added whensortKey
prop was previouslyundefined
Additional Information/Context
n/a
CDK CLI Version
2.88.0
Framework Version
2.88.0
Node.js Version
18
OS
MacOs
Language
Typescript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: