pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Cc: Manuel Rigger <rigger.manuel@gmail.com>
Subject: Re: Broken defenses against dropping a partitioning column
Date: Mon, 08 Jul 2019 11:07:59 -0400
Message-ID: <30500.1562598479@sss.pgh.pa.us> (raw)
In-Reply-To: <CA+TgmoZ7cpTkKsFBun14QhAQ53H_Qi1_vxea=TAG34s=JnPc4Q@mail.gmail.com>
References: <31920.1562526703@sss.pgh.pa.us>
	<20190708143153.GA5929@alvherre.pgsql>
	<CA+TgmoahL7vPpKhZ_CLFJswUjeR_YJTM=56H6dsk9VYgm9MfKQ@mail.gmail.com>
	<CA+TgmoZ7cpTkKsFBun14QhAQ53H_Qi1_vxea=TAG34s=JnPc4Q@mail.gmail.com>

Robert Haas <robertmhaas@gmail.com> writes:
> On Mon, Jul 8, 2019 at 11:02 AM Robert Haas <robertmhaas@gmail.com> wrote:
>> On Mon, Jul 8, 2019 at 10:32 AM Alvaro Herrera <alvherre@2ndquadrant.com> wrote:
>>> That said, I'm not sure I see the use case for an ALTER TABLE .. DROP
>>> COLUMN command that turns a partitioned table (with existing partitions
>>> containing data) into one non-partitioned table with all data minus the
>>> partitioning column(s).

>> I think it would be useful to have "ALTER TABLE blah NOT PARTITIONED" but I

> ...hit send too soon, and also, I don't think anyone will be very
> happy if they get that behavior as a side effect of a DROP statement,
> mostly because it could take an extremely long time to execute.

FWIW, I was imagining the action as being (1) detach all the child
partitions, (2) make parent into a non-partitioned table, (3)
drop the target column in each of these now-independent tables.
No data movement.  Other than the need to acquire locks on all
the tables, it shouldn't be particularly slow.

But I'm still not volunteering to write it, because I'm not sure
anyone would want such a behavior.

			regards, tom lane





view thread (15+ messages)  latest in thread

Message-ID: <30500.1562598479@sss.pgh.pa.us>
Permalink:  ../30500.1562598479@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/30500.1562598479@sss.pgh.pa.us

 · 

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-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, robertmhaas@gmail.com, alvherre@2ndquadrant.com, pgsql-hackers@lists.postgresql.org, rigger.manuel@gmail.com
  Subject: Re: Broken defenses against dropping a partitioning column
  In-Reply-To: <30500.1562598479@sss.pgh.pa.us>

* 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