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

David Rowley <david.rowley@2ndquadrant.com>

From: David Rowley <david.rowley@2ndquadrant.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>, Robert Haas <robertmhaas@gmail.com>, Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>, pgsql-committers <pgsql-committers@postgresql.org>
Date: 2018-07-03T11:16:55Z
Lists: pgsql-hackers

Attachments

On 3 July 2018 at 21:53, Michael Paquier <michael@paquier.xyz> wrote:

> 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.

Oh okay. Yeah, you can hit that with a partitionless sub-partitioned table.

I've added a test in the attached v4.

-- 
 David Rowley                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

Commits

  1. Remove dead code for temporary relations in partition planning

  2. Clarify use of temporary tables within partition trees

  3. Expand partitioned table RTEs level by level, without flattening.