Partitioning Column needs to be Key

Started by Vaishakha Madhavaalmost 7 years ago2 messagesbugs
Jump to latest
#1Vaishakha Madhava
vaishakha.madhava@314ecorp.com

Hi,
When we try to create partitioning table based on a column , If that table
contains a primary key or unique key ,it gives error saying "UNIQUE
constraint on table "ac" lacks column "abc" which is part of the partition
key".

#2legrand legrand
legrand_legrand@hotmail.com
In reply to: Vaishakha Madhava (#1)
Re: Partitioning Column needs to be Key

Hello,
this is not supported yet.
See: https://www.postgresql.org/docs/12/ddl-partitioning.html
that says
"Unique constraints on partitioned tables must include all the partition key
columns.
This limitation exists because PostgreSQL can only enforce uniqueness in
each partition individually."

It is because PostgreSQL doesn't have any "global index" support yet. If you
really want to partition you table on a key that is not in the partition
key, you may have a look at
www.postgresql-archive.org/PostgreSQL-11-global-index-td6032681.html

Regards
PAscal

--
Sent from: https://www.postgresql-archive.org/PostgreSQL-bugs-f2117394.html