Re: Regarding use of single column as primary key on partitioned table - Mailing list pgsql-general

From David G. Johnston
Subject Re: Regarding use of single column as primary key on partitioned table
Date
Msg-id CAKFQuwarcToEtVZHOo5O_CBe4ZD2mGZM35R28kLn=MNi0D6X2w@mail.gmail.com
Whole thread Raw
In response to Regarding use of single column as primary key on partitioned table  (Durgamahesh Manne <maheshpostgres9@gmail.com>)
Responses Re: Regarding use of single column as primary key on partitioned table
List pgsql-general
On Friday, September 27, 2024, Durgamahesh Manne <maheshpostgres9@gmail.com> wrote:

ERROR:  unique constraint on partitioned table must include all partitioning columns
DETAIL:  PRIMARY KEY constraint on table "bet" lacks column "placedon" which is part of the partition key.
test=>

Can't we use primary key on singal column(betid) on partitioned table rather than using composite key (placedon,betid)?

No.  It would be misleading to allow such a thing because a unique index can only span a single partition.

David J.

pgsql-general by date:

Previous
From: Durgamahesh Manne
Date:
Subject: Regarding use of single column as primary key on partitioned table
Next
From: Christophe Pettus
Date:
Subject: Re: Regarding use of single column as primary key on partitioned table