暂无图片
antdb数据库出现“ERROR: Cannot create index whose evaluation cannot be enforced to remote nodes”提示是为什么啊,该怎么解决?
我来答
分享
关耳
2023-09-27
antdb数据库出现“ERROR: Cannot create index whose evaluation cannot be enforced to remote nodes”提示是为什么啊,该怎么解决?

antdb数据库出现“ERROR: Cannot create index whose evaluation cannot be enforced to remote nodes”提示是为什么啊,该怎么解决?

我来答
添加附件
收藏
分享
问题补充
1条回答
默认
最新
暂无图片
亚信安慧AntDB数据库

解决方式

目前非分片键不允许创建主键或唯一索引。
若一定要创建主键,带上分片键即可。
以下给出一个示例说明:

antdb=# create table sy01(id int,name text) distribute by hash(name);
CREATE TABLE
antdb=# ALTER TABLE sy01 add constraint pk_sy01_1 primary key (id);
ERROR:  Cannot create index whose evaluation cannot be enforced to remote nodes
antdb=# ALTER TABLE sy01 add constraint pk_sy01_1 primary key (id,name);
ALTER TABLE
antdb=# \d+ sy01
Table "public.sy01"
Column |  Type   | Modifiers | Storage  | Stats target | Description
--------+---------+-----------+----------+--------------+-------------
id     | integer | not null  | plain    |              |
name   | text    | not null  | extended |              |
Indexes:
"pk_sy01_1" PRIMARY KEY, btree (id, name)
Distribute By: HASH(name)
Location Nodes: ALL DATANODES

暂无图片 评论
暂无图片 有用 0
回答交流
提交
问题信息
请登录之后查看
邀请回答
暂无人订阅该标签,敬请期待~~
暂无图片墨值悬赏