使用antdb数据库,出现“ERROR: Cannot create index whose evaluation cannot be enforced to remote nodes”提示。

0 ajhdf 1年前 526次点击

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

共 1 条评论
0 

解决方式

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

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

添加一条新评论

登录后可以发表评论 去登录