简体   繁体   English

com.datastax.driver.core.exceptions.InvalidQueryException:在SET部分中找到的PRIMARY KEY部分序列

[英]com.datastax.driver.core.exceptions.InvalidQueryException: PRIMARY KEY part sequence found in SET part

I am trying to update the table, then i am getting this exception: 我正在尝试更新表,然后我得到这个例外:

com.datastax.driver.core.exceptions.InvalidQueryException: PRIMARY KEY part sequence found in SET part. com.datastax.driver.core.exceptions.InvalidQueryException:在SET部分中找到的PRIMARY KEY部分序列。

My table structure is 我的表结构是

CREATE TABLE IF NOT EXISTS STYLINGBEE.LKPSTYLES(
    STYLEID ASCII,
    NAME ASCII,
    IMAGE ASCII,
    SEQUENCE INT,
    ACTIVE BOOLEAN,
    PRIMARY KEY (STYLEID,SEQUENCE)
)WITH CLUSTERING ORDER BY (SEQUENCE DESC);

While having your complete query would help, I can tell from the error message that you are trying to UPDATE a row's PRIMARY KEY . 虽然拥有完整的查询会有所帮助,但我可以从错误消息中判断出您正在尝试UPDATE行的PRIMARY KEY From the DataStax documentation on the UPDATE command : UPDATE命令DataStax文档

The UPDATE SET operation is not valid on a primary key field.

This is why you are getting this particular error message. 这就是您收到此特定错误消息的原因。 If you have inserted a row containing a part of the primary key that you need to update, you will have to remove that row and re-insert it. 如果您插入了包含需要更新的主键部分的行,则必须删除该行并重新插入。

Cassandra don't allow you to update primary key. Cassandra不允许您更新主键。 You can not do something like below because SEQUENCE is part of primary key. 你不能做下面的事情,因为SEQUENCE是主键的一部分。

UPDATE STYLINGBEE.LKPSTYLES SET SEQUENCE = 1 WHERE STYLEID = 1000; UPDATE STYLINGBEE.LKPSTYLES SET SEQUENCE = 1 WHERE STYLEID = 1000;

It looks like you are trying to update some row without STYLEID specified in your query (WHERE part). 看起来您正在尝试更新某些行而不在查询中指定STYLEID(WHERE部分)。 Could you please publish your CQL statement. 你能发布你的CQL语句吗? I think this one link could help you: Why doesn't my Cassandra update work? 我认为这一个链接可以帮助您: 为什么我的Cassandra更新不起作用?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 com.datastax.driver.core.exceptions.InvalidQueryException:对于PRIMARY KEY部分无效的运算符IN - com.datastax.driver.core.exceptions.InvalidQueryException: Invalid operator IN for PRIMARY KEY part 线程“ main”中的异常com.datastax.driver.core.exceptions.InvalidQueryException:PRIMARY KEY中引用的未知定义 - Exception in thread “main” com.datastax.driver.core.exceptions.InvalidQueryException: Unknown definition referenced in PRIMARY KEY com.datastax.driver.core.exceptions.InvalidQueryException:未配置的表用户” - com.datastax.driver.core.exceptions.InvalidQueryException: unconfigured table user" 为什么 Cassandra 抛出 com.datastax.driver.core.exceptions.InvalidQueryException:为列找到多个定义 - Why Cassandra throwing com.datastax.driver.core.exceptions.InvalidQueryException: Multiple definitions found for column 使用Datastax Java驱动程序的com.datastax.driver.core.exceptions.InvalidQueryException - com.datastax.driver.core.exceptions.InvalidQueryException using Datastax Java driver 卡桑德拉数据库。 com.datastax.driver.core.exceptions.InvalidQueryException:未配置的表人 - Cassandra DB. com.datastax.driver.core.exceptions.InvalidQueryException: unconfigured table person 引起:com.datastax.driver.core.exceptions.InvalidQueryException:日期 (25) 的预期长度为 8 或 0 字节 - Caused by: com.datastax.driver.core.exceptions.InvalidQueryException: Expected 8 or 0 byte long for date (25) com.datastax.driver.core.exceptions.InvalidQueryException:未配置的表schema_keyspaces - com.datastax.driver.core.exceptions.InvalidQueryException: unconfigured table schema_keyspaces com.datastax.driver.core.exceptions.InvalidQueryException: 未配置表 peers_v2 - com.datastax.driver.core.exceptions.InvalidQueryException: unconfigured table peers_v2 查询失败,并显示“ com.datastax.driver.core.exceptions.InvalidQueryException:字符串未验证。” - Query fails with “com.datastax.driver.core.exceptions.InvalidQueryException: String didn't validate.”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM