Re: Attached partition not considering altered column properties of root partition.

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Amit Langote <amitlangote09(at)gmail(dot)com>
Cc: Prabhat Sahu <prabhat(dot)sahu(at)enterprisedb(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Attached partition not considering altered column properties of root partition.
Date: 2019-07-26 22:16:56
Message-ID: 20190726221656.GA17989@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2019-Jul-03, Amit Langote wrote:

> Thanks for the report. This seems like a bug. Documentation claims
> that the child tables inherit column storage options from the parent
> table. That's actually enforced in only some cases.

> To fix this, MergeAttributesIntoExisting() should check that the
> attribute options of a child don't conflict with the parent, which the
> attached patch implements. Note that partitioning uses the same code
> as inheritance, so the fix applies to it too. After the patch:

Thanks for the patch!

I'm not completely sold on back-patching this. Should we consider
changing it in 12beta and up only, or should we just backpatch it all
the way back to 9.4? It's going to raise errors in cases that
previously worked.

On the patch itself: I think ERRCODE_DATATYPE_MISMATCH is not the
correct one to use for this; maybe ERRCODE_INVALID_OBJECT_DEFINITION or,
more likely, ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE.

"FOO versus BAR" does not sound proper style. Maybe "Child table has
FOO, parent table expects BAR." Or maybe put it all in errmsg,
errmsg("child table \"%s\" has storage option \"%s\" for column \"%s\" mismatching \"%s\" on parent",

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2019-07-26 22:46:35 Re: Duplicated LSN in ReorderBuffer
Previous Message Tomas Vondra 2019-07-26 22:05:52 Re: Multivariate MCV list vs. statistics target