You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Bhupendra Baraiya <Bh...@continuum.net> on 2016/03/29 17:31:23 UTC

Drop and Add column with different datatype in Cassandra

Hi ,

I am using Cassandra 3.0.4
I am using a Table called User which has a column last_login with Map datatype .

I dropped the column using the  syntax Alter Table User Drop last_login;

I dropped the column from table and recreated it with a nested datatype last_login map<varchar,frozen<tuple<timestamp,inet>>>
But then I got an below error

InvalidRequest: code=2200 [Invalid query] message="Cannot add a collection with
the name last_login because a collection with the same name and a different type
(map<text, timestamp>) has already been used in the past"

Does it mean Cassandra does not allow adding of the same column in the Table even though it does not exists in the Table

Thanks and regards,

Bhupendra Baraiya
Continuum Managed Services, LLC.
p: 902-933-0019
e: bhupendra.baraiya@continuum.net<ma...@continuum.net>
w: continuum.net
[http://cdn2.hubspot.net/hub/281750/file-393087232-png/img/logos/email-continuum-logo-151x26.png]<http://www.continuum.net/>


Re: Drop and Add column with different datatype in Cassandra

Posted by Tyler Hobbs <ty...@datastax.com>.
On Tue, Mar 29, 2016 at 10:31 AM, Bhupendra Baraiya <
Bhupendra.Baraiya@continuum.net> wrote:

> Does it mean Cassandra does not allow adding of the same column in the
> Table even though it does not exists in the Table
>

As the error message says, you can't re-add a *collection* column with the
same name.  Other types of columns are fine.


-- 
Tyler Hobbs
DataStax <http://datastax.com/>