Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hkVS4-00056A-2v for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Jul 2019 15:21:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hkVS2-0006OA-T9 for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Jul 2019 15:21:10 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hkVRi-0001SP-O6 for pgsql-hackers@lists.postgresql.org; Mon, 08 Jul 2019 15:20:50 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hkVFJ-0001Fy-Hl for pgsql-hackers@lists.postgresql.org; Mon, 08 Jul 2019 15:08:02 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x68F7xqC030501; Mon, 8 Jul 2019 11:07:59 -0400 From: Tom Lane To: Robert Haas cc: Alvaro Herrera , PostgreSQL Hackers , Manuel Rigger Subject: Re: Broken defenses against dropping a partitioning column In-reply-to: References: <31920.1562526703@sss.pgh.pa.us> <20190708143153.GA5929@alvherre.pgsql> Comments: In-reply-to Robert Haas message dated "Mon, 08 Jul 2019 11:03:23 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <30499.1562598479.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 08 Jul 2019 11:07:59 -0400 Message-ID: <30500.1562598479@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Robert Haas writes: > On Mon, Jul 8, 2019 at 11:02 AM Robert Haas wrot= e: >> On Mon, Jul 8, 2019 at 10:32 AM Alvaro Herrera 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 partition= s >>> containing data) into one non-partitioned table with all data minus th= e >>> partitioning column(s). >> I think it would be useful to have "ALTER TABLE blah NOT PARTITIONED" b= ut 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