Re: Getting ERROR: could not open file "base/13164/t3_16388" withpartition table with ON COMMIT - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Getting ERROR: could not open file "base/13164/t3_16388" withpartition table with ON COMMIT
Date
Msg-id 20181102052715.GW1727@paquier.xyz
Whole thread Raw
In response to Re: Getting ERROR: could not open file "base/13164/t3_16388" withpartition table with ON COMMIT  (Michael Paquier <michael@paquier.xyz>)
Responses Re: Getting ERROR: could not open file "base/13164/t3_16388" withpartition table with ON COMMIT
List pgsql-hackers
On Fri, Nov 02, 2018 at 02:18:04PM +0900, Michael Paquier wrote:
> 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..

A bit more fun with inheritance:
=# begin;
BEGIN
=# create temp table aa_p (a int) on commit drop;
CREATE TABLE
=# create temp table aa_c (a int) inherits (aa_p) on commit delete rows;
NOTICE:  00000: merging column "a" with inherited definition
LOCATION:  MergeAttributes, tablecmds.c:2339
CREATE TABLE
=# insert into aa_p values (1);
INSERT 0 1
=# insert into aa_c values (1);
INSERT 0 1
=# commit;
NOTICE:  00000: drop cascades to table aa_c
LOCATION:  reportDependentObjects, dependency.c:995
ERROR:  XX000: could not open relation with OID 16426
LOCATION:  relation_open, heapam.c:1138

Let's treat that as a separate issue, as this happens also with an
unpatched build.  The only reason why you cannot trigger it with
partitions is that ON COMMIT is currently broken for them, so we should
fix the reported case first.  In consequence, I would tend to commit the
patch proposed and take care of the first, except if of course anybody
has an objection.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Getting ERROR: could not open file "base/13164/t3_16388" withpartition table with ON COMMIT
Next
From: Pavel Stehule
Date:
Subject: Re: COPY FROM WHEN condition