public inbox for [email protected]
help / color / mirror / Atom feedRegarding use of single column as primary key on partitioned table
2+ messages / 2 participants
[nested] [flat]
* Regarding use of single column as primary key on partitioned table
@ 2024-09-28 04:25 Durgamahesh Manne <[email protected]>
2024-09-28 04:39 ` Re: Regarding use of single column as primary key on partitioned table David G. Johnston <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: Durgamahesh Manne @ 2024-09-28 04:25 UTC (permalink / raw)
To: [email protected]; [email protected]
Hi Team
test=> CREATE TABLE public.bet (
betid int4 NOT NULL,
externalbetid text NULL,
externalsystem text NULL,
placedon timestamptz NULL,
createdon timestamptz NULL
) partition by list (placedon) ;
CREATE TABLE
test=> alter table public.bet add primary key (betid);
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)?
Regards,
Durga Mahesh
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Regarding use of single column as primary key on partitioned table
2024-09-28 04:25 Regarding use of single column as primary key on partitioned table Durgamahesh Manne <[email protected]>
@ 2024-09-28 04:39 ` David G. Johnston <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: David G. Johnston @ 2024-09-28 04:39 UTC (permalink / raw)
To: Durgamahesh Manne <[email protected]>; +Cc: [email protected] <[email protected]>; [email protected] <[email protected]>
On Friday, September 27, 2024, Durgamahesh Manne <[email protected]>
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.
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2024-09-28 04:39 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-09-28 04:25 Regarding use of single column as primary key on partitioned table Durgamahesh Manne <[email protected]>
2024-09-28 04:39 ` David G. Johnston <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox