2
0

partdesc.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*-------------------------------------------------------------------------
  2. *
  3. * partdesc.h
  4. *
  5. * Copyright (c) 1996-2022, PostgreSQL Global Development Group
  6. *
  7. * src/include/partitioning/partdesc.h
  8. *
  9. *-------------------------------------------------------------------------
  10. */
  11. #ifndef PARTDESC_H
  12. #define PARTDESC_H
  13. #include "partitioning/partdefs.h"
  14. #include "utils/relcache.h"
  15. /*
  16. * Information about partitions of a partitioned table.
  17. *
  18. * For partitioned tables where detached partitions exist, we only cache
  19. * descriptors that include all partitions, including detached; when we're
  20. * requested a descriptor without the detached partitions, we create one
  21. * afresh each time. (The reason for this is that the set of detached
  22. * partitions that are visible to each caller depends on the snapshot it has,
  23. * so it's pretty much impossible to evict a descriptor from cache at the
  24. * right time.)
  25. */
  26. typedef struct PartitionDescData
  27. {
  28. int nparts; /* Number of partitions */
  29. bool detached_exist; /* Are there any detached partitions? */
  30. Oid *oids; /* Array of 'nparts' elements containing
  31. * partition OIDs in order of the their bounds */
  32. bool *is_leaf; /* Array of 'nparts' elements storing whether
  33. * the corresponding 'oids' element belongs to
  34. * a leaf partition or not */
  35. PartitionBoundInfo boundinfo; /* collection of partition bounds */
  36. } PartitionDescData;
  37. extern PartitionDesc RelationGetPartitionDesc(Relation rel, bool omit_detached);
  38. extern PartitionDirectory CreatePartitionDirectory(MemoryContext mcxt, bool omit_detached);
  39. extern PartitionDesc PartitionDirectoryLookup(PartitionDirectory, Relation);
  40. extern void DestroyPartitionDirectory(PartitionDirectory pdir);
  41. extern Oid get_default_oid_from_partdesc(PartitionDesc partdesc);
  42. #endif /* PARTCACHE_H */