On 2020-Sep-03, Alvaro Herrera wrote: > + /* > + * If setting up a PartitionDispatch for a sub-partitioned table, we may > + * also need a fake ResultRelInfo for checking the partition constraint > + * later; set that up now. > + */ > + if (parent_pd) > + { > + ResultRelInfo *rri = makeNode(ResultRelInfo); > + > + InitResultRelInfo(rri, rel, 1, proute->partition_root, 0); > + proute->nonleaf_partitions[dispatchidx] = rri; > + } > +
Heh, I had intended to remove the attachment before sending, because I thought I was seeing a problem with this proposed coding of mine. But since I sent it by mistake, I'll explain: I think this will fail if we have a partitioned default partition, and we direct the insert to it directly while attaching a partition to its parent. I think that kind of scenario deserves its own test case. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services