Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started



pranali.khanna101994_189965 avatar image
pranali.khanna101994_189965 asked Erick Ramirez answered

Why can I not alter the data type of a column?

As per

we can convert text to varchar by alter command.

I have a table structure like :

CREATE TABLE killrvideo.videos (
    video_id timeuuid PRIMARY KEY,
    added_date timestamp,
    comments text,
    title text

and I want to edit datatype of comments to varchar.

the data is :

Hi ! There
Hi ! Datastax
Hi ! Cassandra
Hi ! Devlopers
Hi ! Admins

but when i execute alter command :

alter table videos alter comments type varchar;
InvalidRequest: Error from server: code=2200 [Invalid query] message="Altering of types is not allowed"

this is failing but why ? compatibility is ok but still not working for me

1 comment
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Can you please provide us the DSE\Cassandra version you are trying this?

0 Likes 0 ·

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered

Support for ALTER TYPE was dropped a number of years ago (CASSANDRA-12443) because it causes a lot of issues including nodes unable to start when replaying commitlog mutations for columns whose type was changed. This is the reason you get the error message "Altering of types is not allowed".

ALTER TYPE support was dropped in C* 3.0.11 and C* 3.10, and it hasn't been available in DataStax Enterprise since DSE 5.0.6.

Thanks for bringing it to our attention and I'll get the references removed from the relevant Docs pages. Cheers!

10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.