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

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Getting ERROR: could not open file "base/13164/t3_16388" withpartition table with ON COMMIT
Дата
Msg-id 20181102051804.GV1727@paquier.xyz
обсуждение исходный текст
Ответ на Re: Getting ERROR: could not open file "base/13164/t3_16388" withpartition table with ON COMMIT  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
Ответы Re: Getting ERROR: could not open file "base/13164/t3_16388" withpartition table with ON COMMIT  (Michael Paquier <michael@paquier.xyz>)
Список 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

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Amit Langote
Дата:
Сообщение: Re: ToDo: show size of partitioned table
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: Getting ERROR: could not open file "base/13164/t3_16388" withpartition table with ON COMMIT