Postgresql分区表加主键错误,提示insufficient columns in PRIMARY KEY constraint definition
insufficientcolumnsinPRIMARYKEYconstraintdefinition
·
给分区表(分区字段 create_time)加主键,主键表id,执行sql的时候出错,提示
ERROR: insufficient columns in PRIMARY KEY constraint definition
DETAIL: PRIMARY KEY constraint on table "swap_data_info" lacks column "create_time" which is part of the partition key.
原因:分区字段必须也得是主键
解决方案:把id和分区字段作为联合主键即可
更多推荐
已为社区贡献1条内容
所有评论(0)