BUG #18949: 分区表创建主键或者唯一约束需要有分区键
| От | PG Bug reporting form |
|---|---|
| Тема | BUG #18949: 分区表创建主键或者唯一约束需要有分区键 |
| Дата | |
| Msg-id | 18949-ccd36f6989cab3cc@postgresql.org обсуждение исходный текст |
| Ответы |
Re: BUG #18949: 分区表创建主键或者唯一约束需要有分区键
|
| Список | pgsql-bugs |
The following bug has been logged on the website: Bug reference: 18949 Logged by: 余 大海 Email address: 1157357742@qq.com PostgreSQL version: 16.2 Operating system: centos7.9 Description: postgres=# CREATE TABLE hash_sales ( postgres(# id INT, postgres(# sale_date DATE, postgres(# amount NUMERIC, postgres(# PRIMARY KEY (id) -- 主键必须包含分区键 postgres(# ) PARTITION BY hash(sale_date ); ERROR: unique constraint on partitioned table must include all partitioning columns DETAIL: PRIMARY KEY constraint on table "hash_sales" lacks column "sale_date" which is part of the partition key. 在oracle中,以上SQL语句可以创建成功,并能保证ID的全局唯一性,但是在PG15\16\17中,分区表创建主键或者唯一约束都需要有分区键,这样会导致ID字段的无法保证全局唯一性。PG18released 中也并没有对此的改进。
В списке pgsql-bugs по дате отправления: