Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g07mL-0006AY-Ig for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Sep 2018 16:14:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g07mK-0006KY-1j for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Sep 2018 16:14:08 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g07mJ-0006KR-NS for pgsql-hackers@lists.postgresql.org; Wed, 12 Sep 2018 16:14:07 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g07mH-00006d-Bn for pgsql-hackers@postgresql.org; Wed, 12 Sep 2018 16:14:06 +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 w8CGE04q007194; Wed, 12 Sep 2018 12:14:01 -0400 From: Tom Lane To: Amit Langote cc: Rajkumar Raghuwanshi , pgsql-hackers Subject: Re: Getting ERROR: could not open file "base/13164/t3_16388" with partition table with ON COMMIT In-reply-to: <2bf804fb-7417-4539-51c5-f6419f1e8741@lab.ntt.co.jp> References: <2bf804fb-7417-4539-51c5-f6419f1e8741@lab.ntt.co.jp> Comments: In-reply-to Amit Langote message dated "Wed, 12 Sep 2018 19:53:39 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <7192.1536768840.1@sss.pgh.pa.us> Date: Wed, 12 Sep 2018 12:14:00 -0400 Message-ID: <7193.1536768840@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Amit Langote writes: > The infamous missing-relkind-check in heap_truncate() seems to be behind > this. Perhaps, a patch like the attached will do? That seems excessively restrictive. Anything that has storage (e.g. matviews) ought to be truncatable, no? I thought we had a macro or utility function somewhere that knew which relkinds have storage, though I can't find it right now. I'd be inclined to instantiate that if it doesn't exist, and then the code here ought to read something like if (RelkindHasStorage(rel->rd_rel->relkind)) heap_truncate_one_rel(rel); Also, possibly the test ought to be inside heap_truncate_one_rel rather than its callers? regards, tom lane