Minor nitpicks: Let me suggest to use get_attnum() in CreateStatistics instead of SearchSysCacheAttName for each column. Also, we use type AttrNumber for attribute numbers rather than int16. Finally in the same function you have an erroneous ERRCODE_UNDEFINED_COLUMN which should be ERRCODE_DUPLICATE_COLUMN in the loop that searches for duplicates.
May I suggest that compare_int16 be named attnum_cmp (just to be consistent with other qsort comparators) and look like return *((const AttrNumber *) a) - *((const AttrNumber *) b); instead of memcmp? -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (firstname.lastname@example.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers