Re: Partitioning with temp tables is broken

From: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>, amul sul <sulamul(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: Re: Partitioning with temp tables is broken
Date: 2018-06-19 09:20:44
Message-ID: CAFjFpRc5Uxg38owxjZmQOuY0jt3_Tn=jz8WzBOY0tt7rSXyGwQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jun 19, 2018 at 1:24 PM, Michael Paquier <michael(at)paquier(dot)xyz> wrote:
> On Tue, Jun 19, 2018 at 04:27:08PM +0900, Amit Langote wrote:
>> Looking at what changed from my patch:
>>
>> - One cannot have both temporary and permanent relations in a given
>> - partition tree. That is, if the root partitioned table is permanent,
>> - so must be its partitions at all levels and vice versa.
>> + Mixing temporary and permanent relations in the same partition tree
>> + is not allowed. Hence, if the root partitioned table is permanent,
>> + so must be its partitions at all levels and vice versa for temporary
>> + relations.
>>
>> The "vice versa" usage in my patch wasn't perhaps right to begin with, but
>> the way your patch extends it make it a bit more confusing. Maybe we
>> should write it as: "... and likewise if the root partitioned table is
>> temporary."
>
> I like you wording better here.

+
+ <listitem>
+ <para>
+ Mixing temporary and permanent relations in the same partition tree
+ is not allowed. Hence, if the root partitioned table is permanent,

Do we want to mention "root" explicitly here?

+ so must be its partitions at all levels and vice versa for temporary
+ relations.
+ </para>
+ </listitem>

Also, we need to mention that all temporary relations should be from the same
session. We can specify tables from other session in "partition of" clause by
using temporary schema of that session.

In general it looks like we could write the above paragraph as
"A permanant partitioned table should have all its partitions permanant. A
temporary partitioned table should have all its partitions temporary and should
belong to the same session which temporary partitioned table belongs to."

Applying this recursively implies that the whole partition tree either consists
of permanant tables or temporary tables but not both.

Looks like MergeAttributes() is doing more than just merging attributes. But
that's not fault of this patch. It's been so for quite some time.

Rest of the patch looks good to me.
--
Best Wishes,
Ashutosh Bapat
EnterpriseDB Corporation
The Postgres Database Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Konstantin Knizhnik 2018-06-19 09:24:44 Re: Invisible Indexes
Previous Message Alexander Korotkov 2018-06-19 09:15:28 Re: Postgres 11 release notes