Re: More on my partitioning problem

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: John Scalia <jayknowsunix(at)gmail(dot)com>, pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: More on my partitioning problem
Date: 2020-11-02 14:34:49
Message-ID: afa308100d47d0f9003225a8d39eae82786a7f1d.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Mon, 2020-11-02 at 07:40 -0500, John Scalia wrote:
> I created a UNIQUE INDEX on the new base table using the original primary key
> and the partitioning key. So far, so good. But doing an ALTER TABLE ADD PRIMARY KEY USING INDEX,
> is not supported. So. being that I already have a unique index here, does it
> really matter if I do not declare a primary key here? Otherwise, how would I go
> about creating a primary key on this partitioned table?

Don't create a unique index and then use it to define a primary key constraint,
create the primary key directly:

ALTER TABLE part ADD PRIMARY KEY (id, part_key);

Yours,
Laurenz
--
Cybertec | https://www.cybertec-postgresql.com

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message John Scalia 2020-11-02 15:38:39 Re: More on my partitioning problem
Previous Message Koteswara Rao Daliparthi 2020-11-02 13:32:19 Generic extremely low cost query - Running long