问题描述
主键约束与唯一约束不兼容问题,下面是建表语句
create table tasks(id serial primary key,
name varchar unique,
description text);
报错如下
ERROR: UNIQUE or PRIMARY KEY definitions are incompatible with each other
HINT: When there are multiple PRIMARY KEY / UNIQUE constraints, they must have at least one column in common.
解决方案
添加distributed by属性,建表语句修改为
create table tasks(id serial primary key,
name varchar unique,
description text)
distributed replicated;
问题原因不太清楚,但莫名其妙地解决了这个问题