Re: pgsql: Clarify use of temporary tables within partition trees - Mailing list pgsql-committers

From Michael Paquier
Subject Re: pgsql: Clarify use of temporary tables within partition trees
Date
Msg-id 20180703095343.GE11732@paquier.xyz
Whole thread Raw
In response to Re: pgsql: Clarify use of temporary tables within partition trees  (David Rowley <david.rowley@2ndquadrant.com>)
Responses Re: pgsql: Clarify use of temporary tables within partition trees
List pgsql-committers
On Tue, Jul 03, 2018 at 09:30:20PM +1200, David Rowley wrote:
> On 3 July 2018 at 21:15, Michael Paquier <michael@paquier.xyz> wrote:
> > Yeah.  Actually I'd like to add a test as well to test the recursion
> > call of expand_partitioned_rtentry.  If you have an idea, please let me
> > know or I'll figure out one by myself and add it probably in
> > create_table.sql.
>
> What specifically do you want to test? There are plenty of partitioned
> tests with sub-partitioned tables. Going by [1], there's no shortage
> of coverage.
>
> Of course, the dead code I'm proposing we remove is not covered.
> There's no way to cover it... it's dead.

Your patch removes this part:
-   /*
-    * If the partitioned table has no partitions or all the partitions are
-    * temporary tables from other backends, treat this as non-inheritance
-    * case.
-    */
-   if (!has_child)
-       parentrte->inh = false;

And adds this equivalent part:
+   /*
+    * If the partitioned table has no partitions, treat this as the
+    * non-inheritance case.
+    */
+   if (partdesc->nparts == 0)
+   {
+       parentrte->inh = false;
+       return;
+   }

As far as I can see from the coverage report, the former is not tested,
and corresponds to the case of a partition leaf which is itself
partitioned but has no partitions, and the new portion is equivalent to
the part removed.  That ought to be tested, particularly as Amit
mentions that there could be improvements with moving it around in
future versions.
--
Michael

Attachment

pgsql-committers by date:

Previous
From: Amit Langote
Date:
Subject: Re: pgsql: Clarify use of temporary tables within partition trees
Next
From: David Rowley
Date:
Subject: Re: pgsql: Clarify use of temporary tables within partition trees