pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: John Scalia <jayknowsunix@gmail.com>
To: pgsql-admin <pgsql-admin@postgresql.org>
Subject: Re: More on my partitioning problem
Date: Mon, 02 Nov 2020 15:34:49 +0100
Message-ID: <afa308100d47d0f9003225a8d39eae82786a7f1d.camel@cybertec.at> (raw)
In-Reply-To: <A74FFBFA-14BE-4FEB-9B0C-AD3AA056BF5C@gmail.com>
References: <A74FFBFA-14BE-4FEB-9B0C-AD3AA056BF5C@gmail.com>

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






view thread (3+ messages)  latest in thread

Message-ID: <afa308100d47d0f9003225a8d39eae82786a7f1d.camel@cybertec.at>
Permalink:  ../afa308100d47d0f9003225a8d39eae82786a7f1d.camel@cybertec.at/
Also on:    postgresql.org/message-id/afa308100d47d0f9003225a8d39eae82786a7f1d.camel@cybertec.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: laurenz.albe@cybertec.at, jayknowsunix@gmail.com
  Subject: Re: More on my partitioning problem
  In-Reply-To: <afa308100d47d0f9003225a8d39eae82786a7f1d.camel@cybertec.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox