Re: Getting ERROR: could not open file "base/13164/t3_16388" with partition table with ON COMMIT

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Rajkumar Raghuwanshi <rajkumar(dot)raghuwanshi(at)enterprisedb(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Getting ERROR: could not open file "base/13164/t3_16388" with partition table with ON COMMIT
Date: 2018-11-02 05:18:04
Message-ID: 20181102051804.GV1727@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Nov 02, 2018 at 01:36:05PM +0900, Amit Langote wrote:
> When writing the test, I noticed something to be pointed out. As of
> 1c7c317cd9d, partitions of a temporary partition table themselves must be
> temporary, but the ON COMMIT action has to be specified for each table
> separately. Maybe, there is nothing to be concerned about here, because
> there's nowhere to record what's specified for the parent to use it on the
> children. So, children's CREATE TABLE commands must specify the ON COMMIT
> action for themselves.

Well, I would actually expect callers to do so. ON COMMIT PRESERVE or
DELETE rows does not make much sense for partitioned tables as
they have no physical presence (like today's thread about tablespaces
which you know about), but it looks better to just let the command go
through instead of complaining about it if we worry about inheritance.
And actually, your point has just made me aware of a second bug:
=# begin;
BEGIN
=# create temp table temp_parent (a int) partition by list (a) on commit
drop;
CREATE TABLE
=# create temp table temp_child_2 partition of temp_parent for values in
(2) on commit delete rows;
CREATE TABLE
=# insert into temp_parent values (2);
INSERT 0 1
=# table temp_parent;
a
---
2
(1 row)
=# commit;
ERROR: XX000: could not open relation with OID 16420
LOCATION: relation_open, heapam.c:1138

This case is funky. The parent gets dropped at commit time, but it does
not know that it should drop the child as well per their dependencies.
This actually goes into the internals of performDeletion(), which is
scary to touch on back-branches just for such cases..
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2018-11-02 05:27:15 Re: Getting ERROR: could not open file "base/13164/t3_16388" with partition table with ON COMMIT
Previous Message Amit Langote 2018-11-02 05:16:56 Re: ToDo: show size of partitioned table