pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: John Scalia <jayknowsunix@gmail.com>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: pgsql-admin <pgsql-admin@postgresql.org>
Subject: Re: Working with partition tables
Date: Thu, 12 Nov 2020 12:42:23 -0500
Message-ID: <910F94F6-4FE6-4A22-8E1E-B790A4F7FEB0@gmail.com> (raw)
In-Reply-To: <CAKFQuwbCYS58u4=PyTAYunVgH=KdOe4+50_-zWDF-TFWfnrNGw@mail.gmail.com>
References: <CAKFQuwbCYS58u4=PyTAYunVgH=KdOe4+50_-zWDF-TFWfnrNGw@mail.gmail.com>

Thanks David, I had only looked at the docs for v.11, as that is what we’re running, and I didn’t see this line. 

We decided to use a Create table temp (LIKE original); and make the alterations there, then create a third table from like the temp but with partitioning, did the same for each partition, then linked those as partitions to the new temp with the partitioning enabled. Finally, we just renamed that third temp to the original name. Was just hoping for a less circuitous route.

Sent from my iPad

> On Nov 12, 2020, at 11:25 AM, David G. Johnston <david.g.johnston@gmail.com> wrote:
> 
> 
>> On Thu, Nov 12, 2020 at 9:18 AM John Scalia <jayknowsunix@gmail.com> wrote:
>> Is there any way to remove the partition key, or do we simply need to create a new table with the structure we need, drop the old one, then rename the new one to that original name and reattach the partitions?
>  
> I'm not super familiar with partitioning but...you can probably do it in the reverse order and avoid the rename.  A partitioned table without partitions seems useless so just drop it, then create a new one with the same name with the correct defintion.
> 
> The documentation is indeed clear though you may be looking in the wrong spot:
> https://www.postgresql.org/docs/13/ddl-partitioning.html
> "It is not possible to turn a regular table into a partitioned table or vice versa."
> 
> David J.
> 

view thread (3+ messages)

Message-ID: <910F94F6-4FE6-4A22-8E1E-B790A4F7FEB0@gmail.com>
Permalink:  ../910F94F6-4FE6-4A22-8E1E-B790A4F7FEB0@gmail.com/
Also on:    postgresql.org/message-id/910F94F6-4FE6-4A22-8E1E-B790A4F7FEB0@gmail.com

 · 

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: jayknowsunix@gmail.com, david.g.johnston@gmail.com
  Subject: Re: Working with partition tables
  In-Reply-To: <910F94F6-4FE6-4A22-8E1E-B790A4F7FEB0@gmail.com>

* 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