Re: [COMMITTERS] pgsql: Implement table partitioning.

From: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
To: Robert Haas <robertmhaas(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [COMMITTERS] pgsql: Implement table partitioning.
Date: 2016-12-22 01:00:18
Message-ID: fc87efc2-ee69-d18b-ecb7-b0cc1ad6f045@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On 2016/12/22 0:31, Robert Haas wrote:
> On Tue, Dec 20, 2016 at 12:22 PM, Alvaro Herrera
> <alvherre(at)2ndquadrant(dot)com> wrote:
>> Robert Haas wrote:
>>> Implement table partitioning.
>>
>> I thought it was odd to use rd_rel->reloftype as a boolean in
>> ATExecAttachPartition, but apparently we do it elsewhere too, so let's
>> leave that complaint for another day.
>
> Ugh. I agree - that's bad style.

Agreed, fixed in the attached patch.

>> What I also found off in the same function is that we use
>> SearchSysCacheCopyAttName() on each attribute and then don't free the
>> result, and don't ever use the returned tuple either. A simple fix, I
>> thought, just remove the "Copy" and add a ReleaseSysCache().
>
> Or use SearchSysCachExists.

Done, too.

>> But then I
>> noticed this whole thing is rather strange -- why not pass a boolean
>> flag down to CreateInheritance() and from there to
>> MergeAttributesIntoExisting() to implement the check? That seems less
>> duplicative.
>
> Hmm, that would be another way to do it.

MergeAttributesIntoExisting() is called by ATExecAddInherit() as well,
where we don't want to check that. Sure, we can only check if
child_is_partition, but I thought it'd be better to keep the shared code
(between regular inheritance and partitioning) as close to the old close
as possible.

Attached patch also fixes a couple of other minor issues.

Thanks,
Amit

Attachment Content-Type Size
ATExecAttachPartition-improvements-1.patch text/x-diff 1.8 KB

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Meskes 2016-12-22 07:36:44 pgsql: Fix buffer overflow on particularly named files and clarify docu
Previous Message Joe Conway 2016-12-21 23:53:12 pgsql: Improve dblink error message when remote does not provide it

Browse pgsql-hackers by date

  From Date Subject
Next Message Joe Conway 2016-12-22 01:06:23 Re: Getting rid of "unknown error" in dblink and postgres_fdw
Previous Message Joel Jacobson 2016-12-22 00:55:47 Re: SET NOT NULL [NOT VALID / CONCURRENTLY]?