Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEXT_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
### New Features and Improvements

* Add `role_arn` field to `databricks_mws_storage_configurations` resource to support sharing S3 buckets between root storage and Unity Catalog ([#5222](https://github.com/databricks/terraform-provider-databricks/issues/5222))
* Include column name and type details in `databricks_sql_table` column type change error message ([#5478](https://github.com/databricks/terraform-provider-databricks/pull/5478))

### Bug Fixes

Expand Down
8 changes: 5 additions & 3 deletions catalog/resource_sql_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -578,11 +578,13 @@ func getColumnType(columnType string) string {
func assertNoColumnTypeDiff(oldCols []interface{}, newColumnInfos []SqlColumnInfo) error {
for i, oldCol := range oldCols {
oldColMap := oldCol.(map[string]interface{})
if getColumnType(oldColMap["type"].(string)) != getColumnType(newColumnInfos[i].Type) {
return fmt.Errorf("changing the 'type' of an existing column is not supported")
oldType := getColumnType(oldColMap["type"].(string))
newType := getColumnType(newColumnInfos[i].Type)
if oldType != newType {
return fmt.Errorf("changing the 'type' of an existing column is not supported: column '%s' type changed from '%s' to '%s'", oldColMap["name"].(string), oldType, newType)
}
if oldColMap["identity"].(string) != string(newColumnInfos[i].Identity) {
return fmt.Errorf("changing the 'identity' type of an existing column is not supported")
return fmt.Errorf("changing the 'identity' type of an existing column is not supported: column '%s' identity changed from '%s' to '%s'", oldColMap["name"].(string), oldColMap["identity"].(string), string(newColumnInfos[i].Identity))
}
}
return nil
Expand Down
2 changes: 1 addition & 1 deletion catalog/resource_sql_table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,7 @@ func TestResourceSqlTableUpdateTable_ColumnsTypeThrowsError(t *testing.T) {
},
},
allowedCommands: []string{},
expectedErrorMsg: "changing the 'type' of an existing column is not supported",
expectedErrorMsg: "changing the 'type' of an existing column is not supported: column 'one' type changed from 'string' to 'int'",
},
)
}
Expand Down
Loading