在Cassandra CQL3中,似乎无法即时添加新列; 说我有这张桌子:
cqlsh:Keyspace2>从用户选择*;
用户名| 出生年份| 性别| 密码 session_token | 州
----------- + ------------ + -------- + ------------ + --- ------------ + -------
史密斯| 1968年| 空| ch @ ngem3a | 空| 空值
jsmith2 | 1963年| 空| ch @ ngem3a2 | 空| 空值
cqlsh:Keyspace2>插入用户(user_name,x)值('jsmith',100);
>错误请求:未知标识符x
也许您打算使用CQL 2? 启动cqlsh时,尝试使用-2选项。
但是警告是正确的,当我进入CQL2时,同样的事情有效:
> Blockquote
cqlsh:Keyspace2> exit
[root@bdvm1 ~]# cqlsh
Connected to Test Cluster at localhost:9160.
[cqlsh 2.2.0 | Cassandra 1.1.9-dse-2.2.2-SNAPSHOT | CQL spec 2.0.0 | Thrift protocol 19.33.0]
Use HELP for help.
cqlsh> use Keyspace1;
cqlsh:Keyspace1> select * from users;
KEY | birth_year | gender
-------+------------+--------
TEST | 1968 | m
TEST1 | 1968 | f
cqlsh:Keyspace1> insert into users (KEY, x) values ('jsmith',100);
cqlsh:Keyspace1> select * from users;
KEY,TEST | birth_year,1968 | gender,m
KEY,TEST1 | birth_year,1968 | gender,f
KEY,jsmith | x,100
有人知道为什么吗? 我以为CQL3是向后兼容的..
谢谢,马特