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
signature.asc
Description: PGP signature