PostgreSQL Source Code  git master
pg_partitioned_table.h
Go to the documentation of this file.
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-2024, 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 
22 #include "catalog/genbki.h"
23 #include "catalog/pg_partitioned_table_d.h"
24 
25 /* ----------------
26  * pg_partitioned_table definition. cpp turns this into
27  * typedef struct FormData_pg_partitioned_table
28  * ----------------
29  */
30 CATALOG(pg_partitioned_table,3350,PartitionedRelationId)
31 {
32  Oid partrelid BKI_LOOKUP(pg_class); /* partitioned table oid */
33  char partstrat; /* partitioning strategy */
34  int16 partnatts; /* number of partition key columns */
35  Oid partdefid BKI_LOOKUP_OPT(pg_class); /* default partition oid;
36  * 0 if there isn't one */
37 
38  /*
39  * variable-length fields start here, but we allow direct access to
40  * partattrs via the C struct. That's because the first variable-length
41  * field of a heap tuple can be reliably accessed using its C struct
42  * offset, as previous fields are all non-nullable fixed-length fields.
43  */
44  int2vector partattrs BKI_FORCE_NOT_NULL; /* each member of the array is
45  * the attribute number of a
46  * partition key column, or 0
47  * if the column is actually
48  * an expression */
49 
50 #ifdef CATALOG_VARLEN
51  oidvector partclass BKI_LOOKUP(pg_opclass) BKI_FORCE_NOT_NULL; /* operator class to
52  * compare keys */
53  oidvector partcollation BKI_LOOKUP_OPT(pg_collation) BKI_FORCE_NOT_NULL; /* user-specified
54  * collation for keys */
55  pg_node_tree partexprs; /* list of expressions in the partition key;
56  * one item for each zero entry in partattrs[] */
57 #endif
59 
60 /* ----------------
61  * Form_pg_partitioned_table corresponds to a pointer to a tuple with
62  * the format of pg_partitioned_table relation.
63  * ----------------
64  */
66 
67 DECLARE_TOAST(pg_partitioned_table, 4165, 4166);
68 
69 DECLARE_UNIQUE_INDEX_PKEY(pg_partitioned_table_partrelid_index, 3351, PartitionedRelidIndexId, pg_partitioned_table, btree(partrelid oid_ops));
70 
71 MAKE_SYSCACHE(PARTRELID, pg_partitioned_table_partrelid_index, 32);
72 
73 /* partattrs can contain zero (InvalidAttrNumber) to represent expressions */
74 DECLARE_ARRAY_FOREIGN_KEY_OPT((partrelid, partattrs), pg_attribute, (attrelid, attnum));
75 
76 #endif /* PG_PARTITIONED_TABLE_H */
signed short int16
Definition: c.h:480
#define BKI_LOOKUP(catalog)
Definition: genbki.h:46
#define BKI_LOOKUP_OPT(catalog)
Definition: genbki.h:47
#define BKI_FORCE_NOT_NULL
Definition: genbki.h:33
int16 attnum
Definition: pg_attribute.h:74
CATALOG(pg_partitioned_table, 3350, PartitionedRelationId)
MAKE_SYSCACHE(PARTRELID, pg_partitioned_table_partrelid_index, 32)
DECLARE_UNIQUE_INDEX_PKEY(pg_partitioned_table_partrelid_index, 3351, PartitionedRelidIndexId, pg_partitioned_table, btree(partrelid oid_ops))
FormData_pg_partitioned_table * Form_pg_partitioned_table
DECLARE_ARRAY_FOREIGN_KEY_OPT((partrelid, partattrs), pg_attribute,(attrelid, attnum))
FormData_pg_partitioned_table
DECLARE_TOAST(pg_partitioned_table, 4165, 4166)
unsigned int Oid
Definition: postgres_ext.h:31
Definition: c.h:702
Definition: c.h:713