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 1hkUgc-0003IA-Qy for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Jul 2019 14:32:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hkUgb-0006fa-DQ for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Jul 2019 14:32:09 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hkUgb-0006fL-4Q for pgsql-hackers@lists.postgresql.org; Mon, 08 Jul 2019 14:32:09 +0000 Received: from mail-qt1-x841.google.com ([2607:f8b0:4864:20::841]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hkUgQ-00014a-0H for pgsql-hackers@lists.postgresql.org; Mon, 08 Jul 2019 14:32:08 +0000 Received: by mail-qt1-x841.google.com with SMTP id 44so14343441qtg.11 for ; Mon, 08 Jul 2019 07:31:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=lFdYbDVjnu7mfkZDUV4YAX+kHN0hwp+qk611sBc+OiM=; b=jBRk61f7XdaP+RDjp1k3gwPdu9L1Guh6sGXyRyvr5A842nJcYUGgyjjYo4vwnBl/Oz y3w1DPcuxZA6kLcx3q7tSjzpJkAag2o10CIGbrIfexTP1Ua0LOEBzwJczdFhomqj7j7v RCVpQVOhH736cmkbzBszbIb5BqXUqKuBsChfQ7RU/bLdDu9p87P7Y9S1mTkxCPiULd77 ZDna4cUek0w0BVSZMseOeKP8gbXzpf0VPc2yxuL4YjMwE/exWAAN3WmRGB4eV+it0jxX QoktMx8pNRZRPkaaHr9Q/iu3Q3OikHAPPcziC3PqYabpVWHy7JIigYYLXd4YU3Tn/sVO qEhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=lFdYbDVjnu7mfkZDUV4YAX+kHN0hwp+qk611sBc+OiM=; b=nQ7/rPwx5u+QauzYmfV4QHTC8nwXLXO6o8TfF2iS2HTvE0YRRiR7YzUa+gt0YwYFGH L+ZMAJTay5nRIhfkYMsZXD1m3gSLmxuSjR8SGPq6Aa6xorP5cF3xJiCaXqx6ejtsibwG kdLRD5xBE7ObmeryvnBRDBLQ9yT1rtBvHL9gtASGI+UZlitkk1wZQTzsfiG8hgZnX/tP 7wNT/RMtoGbHBGLOItJEVDdHBuy3rITf5F3b0vuZHfkBbXcsiU4oPeiIdMs/DUy7K0XQ mijKnUgHbwFXdckcviTz5fhPbnZTiCrWj3rBaayCYGlQ6P9krWcpIq4xJEIcROf3Pe11 rduA== X-Gm-Message-State: APjAAAVHIzOAdyxMLL8+8n25SNy7AskwE5djya0BfnhpgE2jHT1Z2PVV bKlS+VaLzqlG5Jrm7QxdMtnMrA== X-Google-Smtp-Source: APXvYqxfhM3Lc+PdZsa399RVHTHPwmg1B+NwawWBNX8I8rHuXOg+ToZRNDoSC8bQ23TK9czr4Vv70Q== X-Received: by 2002:a0c:8722:: with SMTP id 31mr15327810qvh.164.1562596316096; Mon, 08 Jul 2019 07:31:56 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([179.56.30.174]) by smtp.gmail.com with ESMTPSA id a67sm6550548qkg.131.2019.07.08.07.31.55 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 08 Jul 2019 07:31:55 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id 89A001207B5; Mon, 8 Jul 2019 10:31:53 -0400 (-04) Date: Mon, 8 Jul 2019 10:31:53 -0400 From: Alvaro Herrera To: Tom Lane Cc: pgsql-hackers@lists.postgresql.org, Manuel Rigger Subject: Re: Broken defenses against dropping a partitioning column Message-ID: <20190708143153.GA5929@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <31920.1562526703@sss.pgh.pa.us> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2019-Jul-07, Tom Lane wrote: > Ideally, perhaps, a DROP CASCADE like this would not cascade to > the whole table but only to the table's partitioned-ness property, > leaving you with a non-partitioned table with most of its data > intact. It would take a lot of work to make that happen though, > and it certainly wouldn't be back-patchable, and I'm not really > sure it's worth it. Maybe we can add dependencies to rows of the pg_partitioned_table relation, with the semantics of "depends on the partitioned-ness of the table"? 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). This seems vaguely related to the issue of dropping foreign keys; see https://postgr.es/m/20190329152239.GA29258@alvherre.pgsql wherein I settled with a non-ideal solution to the problem of being unable to depend on something that did not cause the entire table to be dropped in certain cases. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services