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

From Durgamahesh Manne
Subject Regarding use of single column as primary key on partitioned table
Date
Msg-id CAJCZko+pA8o3HDBuGzxzYjMo=Gm_8yBLk7Sod3Fdo-i0WAwLuA@mail.gmail.com
Whole thread Raw
Responses Re: Regarding use of single column as primary key on partitioned table
Re: Regarding use of single column as primary key on partitioned table
List pgsql-general
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

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Request for Insights on ID Column Migration Approach
Next
From: "David G. Johnston"
Date:
Subject: Re: Regarding use of single column as primary key on partitioned table