On Fri, Jun 8, 2018 at 1:52 AM, Tom Lane <t...@sss.pgh.pa.us> wrote > > I'm still of the opinion that find_appinfos_by_relids() needs to be > nuked from orbit. It has nothing to recommend it either from the > standpoint of performance or that of intellectual coherency (or maybe > that problem is just inadequate documentation). The places consuming > its results are no better.
Here's patch with some comments added to find_appinfos_by_relid(), adjust_appendrel_attrs and ajust_appendrel_attrs_context. There was no explanation about AppendRelInfo argument to adjust_appendrel_attrs or its context in pre-v11 code. May be that was implicit in the first paragraph. But then that implicit-ness holds true for AppendRelInfo array as well. So, it was not changed when we changed the signature of ajdust_appendrel_attrs(). > > I was also pretty unhappy to discover, as I poked around in the code, that > recent partitioning patches have introduced various assumptions about the > ordering of the append_rel_list. It's bad enough that those exist at all; > it's worse that they're documented, if at all, only beside the code that > will fail (usually silently) if they're violated. Not silently exactly; a build with assert would trip the assertion in inheritance_planner() at line 1295. So any changes to that assumption would be caught by our regression first. I agree that is not so useful in production, but it wouldn't go, thanks to our regression. > I do not find this > acceptable. If we cannot avoid these assumptions, they need to be > documented more centrally, like in the relation.h block comment for struct > AppendRelInfo. > Attached patch adds the assumption to the block you mention above. Please check. -- Best Wishes, Ashutosh Bapat EnterpriseDB Corporation The Postgres Database Company
pg_arl.patch
Description: Binary data