Re: Assertion failure with ALTER TABLE ATTACH PARTITION with log_min_messages >= DEBUG1

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Postgres hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Assertion failure with ALTER TABLE ATTACH PARTITION with log_min_messages >= DEBUG1
Date: 2018-10-06 02:27:59
Message-ID: 20181006022759.fjgglk455zi5ultm@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 2018-Oct-06, Michael Paquier wrote:

> On Fri, Oct 05, 2018 at 12:41:29PM -0300, Alvaro Herrera wrote:
> > On 2018-Oct-05, Michael Paquier wrote:
> >> Looking at the stack trace there is this log in
> >> validateForeignKeyConstraint:
> >> ereport(DEBUG1,
> >> (errmsg("validating foreign key constraint \"%s\"", conname)));
> >>
> >> However conname is set to NULL in this code path.
> >
> > Ouch. Thanks for catching this one. I think the "this is all we need"
> > comment is just asking for trouble :-(
> Would you reformulate it? Like, say, if new fields are needed perhaps
> we could just say instead "XXX: make sure to update the list of fields
> copied if a new partition-relation command needs it."

Well, I think partially filling the struct is bad style. I'm going to
be messing with that shortly anyway, when adding support for FKs
pointing to partitioned tables; maybe just leave it as is for now and
I'll see about that later.

> >> From what I can see the problem comes from CloneForeignKeyConstraint
> >> which forgets to assign the constraint name when cloning the FK
> >> definition. While looking at the ATTACH PARTITION code, I have noticed
> >> that a variable gets overridden, which is in my opinion bad style.
> >
> > Ugh, yeah that looks bad. I wish the compiler would warn about this :-(
> Do you want me to take care of this one? On this issue, I am way more
> confident than the other thread for event triggers as I spent quite some
> time on it.

Please feel free if you have the time, thanks.

Álvaro Herrera
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Gierth 2018-10-06 02:48:02 Re: Early WIP/PoC for inlining CTEs
Previous Message Alvaro Herrera 2018-10-06 01:10:09 Re: Segfault when creating partition with a primary key and sql_drop trigger exists