Zhihong Yu <zyu@yugabyte.com> writes:
>> if (found != ncheck)
> Since there is check on found being smaller than ncheck inside the loop,
> the if condition can be written as:
> if (found < ncheck)
Doesn't really seem like an improvement? Nor am I excited about renaming
these "found" variables, considering that those names can be traced back
more than twenty years.
> + if (found != ndef)
> + elog(WARNING, "%d attrdef record(s) missing for rel %s",
> + ndef - found, RelationGetRelationName(relation));
> Since only warning is logged, there seems to be some wasted space in
> attrdef. Would such space accumulate, resulting in some memory leak ?
No, it's just one palloc chunk either way. I do not think there is
any value in adding more code to reclaim the unused array slots a
bit sooner. (Because of aset.c's power-of-two allocation practices,
it's likely there would be zero actual space savings anyway.)
regards, tom lane