Re: [COMMITTERS] pgsql: Implement table partitioning.

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

On Wed, Dec 21, 2016 at 8:00 PM, Amit Langote
<Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> wrote:
> 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.

Committed.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2016-12-22 19:20:50 pgsql: Fix broken error check in _hash_doinsert.
Previous Message Joe Conway 2016-12-22 17:49:29 pgsql: Make dblink try harder to form useful error messages

Browse pgsql-hackers by date

  From Date Subject
Next Message Joe Conway 2016-12-22 17:54:32 Re: Getting rid of "unknown error" in dblink and postgres_fdw
Previous Message Robert Haas 2016-12-22 17:44:22 Re: Potential data loss of 2PC files