简体   繁体   中英

Redshift won't change column type

I'm trying to change a column in Redshift from varchar to integer. I've already checked and the strings are all numbers so it should force fine.

When I run:

alter table schema.table_name alter column "id" type int;

I get the following error:

ERROR: target data type "int8" is not supported [SQL State=0A000]

I've checked the Redshift documentation and just to rule out a few potentials:

  • The field is not a primary or foreign key
  • There's no compression encodings on it
  • There's no default values
  • The code is not in a transaction block

Any pointers would be amazing, thank you!

Alter column type is for varchar types - "ALTER COLUMN column_name TYPE new_data_type -- A clause that changes the size of a column defined as a VARCHAR data type." See: https://docs.aws.amazon.com/redshift/latest/dg/r_ALTER_TABLE.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM