Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cr3jP-0003IE-Ca for pgsql-hackers@arkaria.postgresql.org; Thu, 23 Mar 2017 14:28:51 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cr3jO-0000wo-Vb for pgsql-hackers@arkaria.postgresql.org; Thu, 23 Mar 2017 14:28:51 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cr3hu-0006eZ-Kl for pgsql-hackers@postgresql.org; Thu, 23 Mar 2017 14:27:18 +0000 Received: from mail.postgrespro.ru ([93.174.131.138]) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cr3hr-00017M-VM for pgsql-hackers@postgresql.org; Thu, 23 Mar 2017 14:27:18 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id F01A021C26D6; Thu, 23 Mar 2017 17:27:14 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru Subject: Re: Partitioned tables and relfilenode DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1490279234; bh=KozYCCOJQhicC/l+BWm1+krrnSXP/mulLby2No5FzmI=; h=To:References:From:Date:In-Reply-To; b=K8q5GlgcsEb1UAqtbPLsYgXbUgiLdn82cN7434A/+nVj5lJM9oO9Nz+sLI7iVwEgH rjt++cSK8DQylXRI+OhUR/zkZkaZdA8yEhxCb3XeoHXrdFNNMs9ZZImuMumuz7Zhys 9p09iCVgWBnvMkTjGESGYN1C4/VdnzaXs2Pm3sUQ= To: Amit Langote , Robert Haas , "pgsql-hackers@postgresql.org" References: <2b0d42f2-3a53-763b-c9c2-47139e4b1c2e@lab.ntt.co.jp> <30f05f6d-7341-b9b0-a089-2b626abc133b@lab.ntt.co.jp> <5f5688f7-809e-5be9-f2b1-75e8b62cf548@lab.ntt.co.jp> <6837c359-45c4-8044-34d1-736756335a15@lab.ntt.co.jp> From: Maksim Milyutin Message-ID: <5c1adf61-3293-1365-e31c-b6f672446c73@postgrespro.ru> Date: Thu, 23 Mar 2017 17:27:14 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------37E5F074D0C264CE8124ECC5" X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org This is a multi-part message in MIME format. --------------37E5F074D0C264CE8124ECC5 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hi! I have noticed that there is scheduled unlinking of nonexistent physical storage under partitioned table when we execute DROP TABLE statement on this partitioned table. Though this action doesn't generate any error under typical behavior of postgres because the error of storage's lack is caught through if-statement [1] I think it is not safe. My patch fixes this issue. 1. src/backend/storage/smgr/md.c:1385 -- Maksim Milyutin Postgres Professional: http://www.postgrespro.com Russian Postgres Company --------------37E5F074D0C264CE8124ECC5 Content-Type: text/x-patch; name="exclude_unlinking_storage_for_partitioned_table.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="exclude_unlinking_storage_for_partitioned_table.patch" diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c index 3999e6e..36917c8 100644 --- a/src/backend/catalog/heap.c +++ b/src/backend/catalog/heap.c @@ -1823,7 +1823,8 @@ heap_drop_with_catalog(Oid relid) */ if (rel->rd_rel->relkind != RELKIND_VIEW && rel->rd_rel->relkind != RELKIND_COMPOSITE_TYPE && - rel->rd_rel->relkind != RELKIND_FOREIGN_TABLE) + rel->rd_rel->relkind != RELKIND_FOREIGN_TABLE && + rel->rd_rel->relkind != RELKIND_PARTITIONED_TABLE) { RelationDropStorage(rel); } --------------37E5F074D0C264CE8124ECC5 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers --------------37E5F074D0C264CE8124ECC5--