Re: Regarding use of single column as primary key on partitioned table

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Durgamahesh Manne <maheshpostgres9(at)gmail(dot)com>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>, "pgsql-in-general(at)postgresql(dot)org" <pgsql-in-general(at)postgresql(dot)org>
Subject: Re: Regarding use of single column as primary key on partitioned table
Date: 2024-09-28 04:39:21
Message-ID: CAKFQuwarcToEtVZHOo5O_CBe4ZD2mGZM35R28kLn=MNi0D6X2w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-in-general

On Friday, September 27, 2024, Durgamahesh Manne <maheshpostgres9(at)gmail(dot)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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Christophe Pettus 2024-09-28 04:39:40 Re: Regarding use of single column as primary key on partitioned table
Previous Message Durgamahesh Manne 2024-09-28 04:25:57 Regarding use of single column as primary key on partitioned table

Browse pgsql-in-general by date

  From Date Subject
Next Message Christophe Pettus 2024-09-28 04:39:40 Re: Regarding use of single column as primary key on partitioned table
Previous Message Durgamahesh Manne 2024-09-28 04:25:57 Regarding use of single column as primary key on partitioned table