Here is a mini-patch on top of yours to fix a few cosmetic things.
I don't understand the variable name "third". I don't see a "first" or
"second" nearby.
I find some of the columns in pg_constraint confusing. For a primary
key on a partitioned table, for the PK on the partition I get
conislocal = false, coninhcount = 1, connoinherit = true
The last part is confusing to me.
I don't know if that's really on this patch. But perhaps it could be
documented better.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services