I found this feature merged; thanks for this work.
I tested it and found that one place in the error errcode may need to be changed.
In checkPartition():
...
if (get_partition_parent(partRelOid, false) != RelationGetRelid(rel)) ereport(ERROR, errcode(ERRCODE_UNDEFINED_TABLE), errmsg("relation \"%s\" is not a partition of relation \"%s\"",
...
ERRCODE_UNDEFINED_TABLE usually means "table does not exist."
When entering here, the table should exist, otherwise table_open() already reports an error.
I found another two errcode in checkPartition() use ERRCODE_WRONG_OBJECT_TYPE,
In the attached patch, I replace ERRCODE_UNDEFINED_TABLE with ERRCODE_WRONG_OBJECT_TYPE.