Re: pgsql: Clarify use of temporary tables within partition trees

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
Cc: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>, Robert Haas <robertmhaas(at)gmail(dot)com>, Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>, pgsql-committers <pgsql-committers(at)postgresql(dot)org>
Subject: Re: pgsql: Clarify use of temporary tables within partition trees
Date: 2018-07-03 09:53:43
Message-ID: 20180703095343.GE11732@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Tue, Jul 03, 2018 at 09:30:20PM +1200, David Rowley wrote:
> On 3 July 2018 at 21:15, Michael Paquier <michael(at)paquier(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro HORIGUCHI 2018-07-03 10:01:44 Re: shared-memory based stats collector
Previous Message Amit Langote 2018-07-03 09:50:15 Re: pgsql: Clarify use of temporary tables within partition trees

Browse pgsql-committers by date

  From Date Subject
Next Message David Rowley 2018-07-03 11:16:55 Re: pgsql: Clarify use of temporary tables within partition trees
Previous Message Amit Langote 2018-07-03 09:50:15 Re: pgsql: Clarify use of temporary tables within partition trees