Re: [BUGS] BUG #14866: The generated constraint in the typed table causes the server to crash

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, gomer94(at)yandex(dot)ru, PostgreSQL mailing lists <pgsql-bugs(at)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>, Amit Langote <amitlangote09(at)gmail(dot)com>
Subject: Re: [BUGS] BUG #14866: The generated constraint in the typed table causes the server to crash
Date: 2017-11-15 01:23:20
Message-ID: CAB7nPqQj1RYJ-h66GcgW9Rs2Lv4L3HakUrv8FbaA1Uofp6DJLQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Nov 13, 2017 at 4:32 PM, Amit Langote
<Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> wrote:
> In early versions of the partitioning patch, there used to be a
> transformPartitionOf() which would do the same job as transformOfType(),
> that is, make new ColumnDef's from the parent table's attributes. But, I
> removed it in favor of making MergeAttributes() create those ColumnDef's,
> because the latter needed to lock and open the parent anyway. However, to
> handle identity columns, it seems we might need to go back to having a
> transformPartitionOf() after all, but it's going to be quite some work.

Another idea that could be done here is to rework as well
transformOfType() so as its column definition logic is pulled down to
MergeAttributes(). There is some logic telling that the typed columns
are first in the list. That's not lovely IMO.

>> for two, for typed tables, this patch adds another code path to
>> complain about ERRCODE_UNDEFINED_COLUMN, which is also a duplicate of
>> something that should fail in tablecmds.c in my opinion.
>
> The duplication is unfortunate, but the code in tablecmds.c you seem to be
> talking about (in MergeAttributes()) won't be able to satisfy the
> requirement that the sequence for the identity column of a typed table be
> created before the table itself is created. By that point, we're already
> in DefineRelation() creating the table. In fact, I think to fix the
> duplication, it might be better to work on removing the relevant code in
> MergeAttributes().

Yeah, possibly. This really requires more thinking as we likely don't
want to make the code more a mess than it is now. There is no urgency
in getting things refactored now anyway. And perhaps there will be no
need to do so.
--
Michael

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Jeevan Chalke 2017-11-15 08:51:33 Re: [BUGS] BUG #14890: Error grouping by same column twice using FDW
Previous Message Tom Lane 2017-11-14 23:13:02 Re: BUG #14907: missing postgis extension files