I think this is a good improvement. On top of that, I propose a new file partitioning/partdefs.h with the following approximate contents. This reduces cross-inclusion of headers to the minimum. I'm dealing with the fallout from this now, will post a complete patch shortly.
/*------------------------------------------------------------------------- * * partdefs.h * Base definitions for partitioned table handling * * Copyright (c) 2007-2018, PostgreSQL Global Development Group * * src/include/partitioning/partdefs.h * *------------------------------------------------------------------------- */ #ifndef PARTDEFS_H #define PARTDEFS_H typedef enum PartitionRangeDatumKind { PARTITION_RANGE_DATUM_MINVALUE = -1, /* less than any other value */ PARTITION_RANGE_DATUM_VALUE = 0, /* a specific (bounded) value */ PARTITION_RANGE_DATUM_MAXVALUE = 1 /* greater than any other value */ } PartitionRangeDatumKind; typedef struct PartitionBoundInfoData *PartitionBoundInfo; typedef struct PartitionKeyData *PartitionKey; typedef struct PartitionBoundSpec PartitionBoundSpec; typedef struct PartitionDescData *PartitionDesc; #endif /* PARTDEFS_H */ -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services