PLANNED MAINTENANCE

Hello, DataStax Community!

We want to make you aware of a few operational updates which will be carried out on the site. We are working hard to streamline the login process to integrate with other DataStax resources. As such, you will soon be prompted to update your password. Please note that your username will remain the same.

As we work to improve your user experience, please be aware that login to the DataStax Community will be unavailable for a few hours on:

  • Wednesday, July 15 16:00 PDT | 19:00 EDT | 20:00 BRT
  • Thursday, July 16 00:00 BST | 01:00 CEST | 04:30 IST | 07:00 CST | 09:00 AEST

For more info, check out the FAQ page. Thank you for being a valued member of our community.


question

pranali.khanna101994_189965 avatar image
pranali.khanna101994_189965 asked ·

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

As per https://docs.datastax.com/en/archived/cql/3.3/cql/cql_reference/cql_data_types_c.html#cql_data_types_c__cql_data_type_compatibility

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 :

comments
----------------
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

cassandracql
1 comment
10 |1000 characters needed characters left characters exceeded

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!

Share
10 |1000 characters needed characters left characters exceeded

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