[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgresql-admin
Subject:    Re: Working with partition tables
From:       John Scalia <jayknowsunix () gmail ! com>
Date:       2020-11-12 17:42:23
Message-ID: 910F94F6-4FE6-4A22-8E1E-B790A4F7FEB0 () gmail ! com
[Download RAW message or body]

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.
> 


[Attachment #3 (text/html)]

<html><head><meta http-equiv="content-type" content="text/html; \
charset=utf-8"></head><body dir="auto">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.&nbsp;<div><br></div><div>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.<br><br><div \
dir="ltr">Sent from my iPad</div><div dir="ltr"><br><blockquote type="cite">On Nov \
12, 2020, at 11:25 AM, David G. Johnston &lt;david.g.johnston@gmail.com&gt; \
wrote:<br><br></blockquote></div><blockquote type="cite"><div dir="ltr"><div \
dir="ltr"><div dir="ltr"><div class="gmail_default" \
style="font-family:arial,helvetica,sans-serif"><span \
style="font-family:Arial,Helvetica,sans-serif">On Thu, Nov 12, 2020 at 9:18 AM John \
Scalia &lt;<a href="mailto:jayknowsunix@gmail.com">jayknowsunix@gmail.com</a>&gt; \
wrote:</span><br></div></div><div class="gmail_quote"><blockquote class="gmail_quote" \
style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex">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?<br></blockquote><div>&nbsp;</div><div class="gmail_default" \
style="font-family:arial,helvetica,sans-serif">I'm not super familiar with \
partitioning but...you can probably do it in the reverse order and avoid the \
rename.&nbsp; A partitioned table without partitions seems useless so just drop it, \
then create a new one with the same name with the correct defintion.</div><div \
class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div \
class="gmail_default" style="font-family:arial,helvetica,sans-serif">The \
documentation is indeed clear though you may be looking in the wrong spot:</div><div \
class="gmail_default" style="font-family:arial,helvetica,sans-serif"><a \
href="https://www.postgresql.org/docs/13/ddl-partitioning.html">https://www.postgresql.org/docs/13/ddl-partitioning.html</a><br></div><div \
class="gmail_default" style="font-family:arial,helvetica,sans-serif">"It is not \
possible to turn a regular table into a partitioned table or vice versa."</div><div \
class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div \
class="gmail_default" style="font-family:arial,helvetica,sans-serif">David \
J.</div><div class="gmail_default" \
style="font-family:arial,helvetica,sans-serif"><br></div></div></div> \
</div></blockquote></div></body></html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic