On Wed, Dec 21, 2016 at 8:00 PM, Amit Langote <langote_amit...@lab.ntt.co.jp> wrote: > On 2016/12/22 0:31, Robert Haas wrote: >> On Tue, Dec 20, 2016 at 12:22 PM, Alvaro Herrera >> <alvhe...@2ndquadrant.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 -- Sent via pgsql-hackers mailing list (firstname.lastname@example.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers