pg_partitioned_table.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*-------------------------------------------------------------------------
  2. *
  3. * pg_partitioned_table.h
  4. * definition of the "partitioned table" system catalog
  5. * (pg_partitioned_table)
  6. *
  7. *
  8. * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
  9. * Portions Copyright (c) 1994, Regents of the University of California
  10. *
  11. * src/include/catalog/pg_partitioned_table.h
  12. *
  13. * NOTES
  14. * The Catalog.pm module reads this file and derives schema
  15. * information.
  16. *
  17. *-------------------------------------------------------------------------
  18. */
  19. #ifndef PG_PARTITIONED_TABLE_H
  20. #define PG_PARTITIONED_TABLE_H
  21. #include "catalog/genbki.h"
  22. #include "catalog/pg_partitioned_table_d.h"
  23. /* ----------------
  24. * pg_partitioned_table definition. cpp turns this into
  25. * typedef struct FormData_pg_partitioned_table
  26. * ----------------
  27. */
  28. CATALOG(pg_partitioned_table,3350,PartitionedRelationId)
  29. {
  30. Oid partrelid BKI_LOOKUP(pg_class); /* partitioned table oid */
  31. char partstrat; /* partitioning strategy */
  32. int16 partnatts; /* number of partition key columns */
  33. Oid partdefid BKI_LOOKUP_OPT(pg_class); /* default partition oid;
  34. * 0 if there isn't one */
  35. /*
  36. * variable-length fields start here, but we allow direct access to
  37. * partattrs via the C struct. That's because the first variable-length
  38. * field of a heap tuple can be reliably accessed using its C struct
  39. * offset, as previous fields are all non-nullable fixed-length fields.
  40. */
  41. int2vector partattrs BKI_FORCE_NOT_NULL; /* each member of the array is
  42. * the attribute number of a
  43. * partition key column, or 0
  44. * if the column is actually
  45. * an expression */
  46. #ifdef CATALOG_VARLEN
  47. oidvector partclass BKI_LOOKUP(pg_opclass) BKI_FORCE_NOT_NULL; /* operator class to
  48. * compare keys */
  49. oidvector partcollation BKI_LOOKUP_OPT(pg_collation) BKI_FORCE_NOT_NULL; /* user-specified
  50. * collation for keys */
  51. pg_node_tree partexprs; /* list of expressions in the partition key;
  52. * one item for each zero entry in partattrs[] */
  53. #endif
  54. } FormData_pg_partitioned_table;
  55. /* ----------------
  56. * Form_pg_partitioned_table corresponds to a pointer to a tuple with
  57. * the format of pg_partitioned_table relation.
  58. * ----------------
  59. */
  60. typedef FormData_pg_partitioned_table *Form_pg_partitioned_table;
  61. DECLARE_TOAST(pg_partitioned_table, 4165, 4166);
  62. DECLARE_UNIQUE_INDEX_PKEY(pg_partitioned_table_partrelid_index, 3351, PartitionedRelidIndexId, on pg_partitioned_table using btree(partrelid oid_ops));
  63. /* partattrs can contain zero (InvalidAttrNumber) to represent expressions */
  64. DECLARE_ARRAY_FOREIGN_KEY_OPT((partrelid, partattrs), pg_attribute, (attrelid, attnum));
  65. #endif /* PG_PARTITIONED_TABLE_H */