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

2024-09-27 Thread Ron Johnson
On Sat, Sep 28, 2024 at 12:55 AM Tom Lane wrote: > Ron Johnson writes: > > On Sat, Sep 28, 2024 at 12:39 AM David G. Johnston < > > david.g.johns...@gmail.com> wrote: > >> On Friday, September 27, 2024, Durgamahesh Manne < > >>> Can't we use primary key on singal column(betid) on partitioned tab

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

2024-09-27 Thread Tom Lane
Ron Johnson writes: > On Sat, Sep 28, 2024 at 12:39 AM David G. Johnston < > david.g.johns...@gmail.com> wrote: >> On Friday, September 27, 2024, Durgamahesh Manne < >>> Can't we use primary key on singal column(betid) on partitioned table >>> rather than using composite key (placedon,betid)? >>

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

2024-09-27 Thread Ron Johnson
On Sat, Sep 28, 2024 at 12:39 AM David G. Johnston < david.g.johns...@gmail.com> wrote: > On Friday, September 27, 2024, Durgamahesh Manne < > maheshpostgr...@gmail.com> wrote: > >> >> ERROR: unique constraint on partitioned table must include all >> partitioning columns >> DETAIL: PRIMARY KEY c

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

2024-09-27 Thread Christophe Pettus
> On Sep 27, 2024, at 21:25, Durgamahesh Manne > wrote: > > Can't we use primary key on singal column(betid) on partitioned table rather > than using composite key (placedon,betid)? No. Any unique constraint on a partitioned table must include the partition key, including a primary key co

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

2024-09-27 Thread David G. Johnston
On Friday, September 27, 2024, Durgamahesh Manne 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 o

Regarding use of single column as primary key on partitioned table

2024-09-27 Thread Durgamahesh Manne
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