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

From Ron Johnson
Subject Re: Regarding use of single column as primary key on partitioned table
Date
Msg-id CANzqJaAknAV3vhxQ3tnJkGbHEmQJwWhi5jVW7wYkwZx4WQh2DA@mail.gmail.com
Whole thread Raw
In response to Re: Regarding use of single column as primary key on partitioned table  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: Regarding use of single column as primary key on partitioned table
List pgsql-general
On Sat, Sep 28, 2024 at 12:39 AM David G. Johnston <david.g.johnston@gmail.com> wrote:
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.

That is IMO a serious (and probably unfixable, given how PG stores tables) flaw in PG's partitioning design.

--
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> crustacean!

pgsql-general by date:

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