I have table homes_passed which has a column street_number which is not nullable and is of type INT64. I wanted to change the column to STRING using alter table command, but for some reason I am unable to achieve it.
Is there any rules in changing the types of a column? I couldn't locate the rules in the document. Any pointer would be helpful.
Please note that, the table is empty and the column is not a part of any index.
Here is the Operation Status I receive.
{
"name":"projects/*****************/instances/my-instance/databases/my-database/operations/_auto_15*************",
"metadata":{
"@type":"type.googleapis.com/google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata",
"database":"projects/*****************/instances/my-instance/databases/my-database",
"statements":[
"ALTER TABLE homes_passed ALTER COLUMN street_number STRING(130) NOT NULL"
]
},
"done":true,
"error":{
"code":3,
"message":"Cannot change type of column homes_passed.street_number from INT64 to STRING."
}
}
This modification is not allowed in a Google Cloud Spanner database. Only the following alterations are allowed: https://cloud.google.com/spanner/docs/schema-updates#supported_schema_updates