Search code examples
error-handlingcassandramultiple-columns

Cassandra Database issue while im Insert into a new column


I've just installed Cassandra database because as I saw it provides dynamically creating of new columns in a table without need to altering it But when I make a dummy Insert like:

INSERT INTO mytable (id, name, age, description) VALUES (uuid(), 'John Doe', 25, 'Test');

where the mytable has id,name,age and it doesnt have description column it returns me error:

InvalidRequest: Error from server: code=2200 [Invalid query] message="Undefined column name description in table mykeyspace.mytable"

Isnt it supposed to dynamically make the description column inside the mytable?


Solution

  • Without the existence of the description column, it won't auto-create it for you within mytable.

    You could do,

    ALTER TABLE mytable ADD description TEXT;
    

    and your INSERTs with the description column will begin working again.