作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在这里看到许多使用 NOT NULL 约束创建表的示例。具有讽刺意味的是,我似乎不能做同样的事情。
这是我使用的 cql 命令:
CREATE TABLE activities_dev (activity_id uuid ,actor_id bigint NOT NULL, actor_appid bigint NOT NULL, item_id text NOT NULL, verb text NOT NULL,viewer_id bigint NOT NULL,viewer_appid bigint NOT NULL, ts timestamp, PRIMARY KEY(activity_id,actor_id,actor_appid,item_id,verb));
SyntaxException: line 1:62 mismatched input 'NOT' expecting ')' (...activities_dev(activity_id uuid, actor_id integer [NOT] NULL...)
最佳答案
在 Cassandra 中,不支持 NOT NULL 关键字。
对于主键列,cassandra 会自动处理。如果您尝试将 null 插入任何主键值,cassandra 将抛出异常Invalid null value in condition for column
关于Cassandra:创建表时不能使用 'NOT NULL' 约束,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41100756/
我是一名优秀的程序员,十分优秀!