On 2018/02/14 10:00, Amit Langote wrote:
> Agree with the proposed reorganizing and adding a partcache.c, which I
> tried to do in the attached patch.
>
> * The new src/backend/utils/cache/partcache.c contains functions that
> initialize relcache's partitioning related fields. Various partition
> bound comparison and search functions (and then some) that work off of the
> cached information are moved. Also, since we cache partition qual,
> interface functions RelationGetPartitioQual(Relation) and
> get_partition_qual_relid(Oid) are moved too.
>
> * The new src/include/utils/partcache.h contains various struct
> definitions that are moved from backend/catalog/partition.c,
> include/catalog/partition.h, and include/utils/rel.h. Also, declarations
> of interface functions of partcache.c.
Attached updated version, where I removed #include "catalog/partition.h"
from even more places and also moved map_partition_varattnos() next to
map_variable_attnos() in rewriteManip.c.
Now, after applying the patch -
Files #including partition.h
File Line
0 src/backend/catalog/heap.c 44 #include "catalog/partition.h"
1 src/backend/catalog/partition.c 22 #include "catalog/partition.h"
2 src/backend/commands/indexcmds.c 26 #include "catalog/partition.h"
3 src/backend/commands/tablecmds.c 33 #include "catalog/partition.h"
4 src/backend/utils/cache/partcache.c 23 #include "catalog/partition.h"
Files #including partcache.h
File Line
0 src/backend/optimizer/path/joinrels.c 24 #include "utils/partcache.h"
1 src/backend/optimizer/prep/prepunion.c 51 #include "utils/partcache.h"
2 src/backend/optimizer/util/relnode.c 30 #include "utils/partcache.h"
3 src/backend/utils/cache/partcache.c 37 #include "utils/partcache.h"
4 src/backend/utils/cache/relcache.c 83 #include "utils/partcache.h"
5 src/include/executor/execPartition.h 19 #include "utils/partcache.h"
6 src/include/utils/rel.h 27 #include "utils/partcache.h"
Thanks,
Amit