PostgreSQL Source Code  git master
pg_inherits.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * pg_inherits.h
4  * definition of the "inherits" system catalog (pg_inherits)
5  *
6  *
7  * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * src/include/catalog/pg_inherits.h
11  *
12  * NOTES
13  * The Catalog.pm module reads this file and derives schema
14  * information.
15  *
16  *-------------------------------------------------------------------------
17  */
18 #ifndef PG_INHERITS_H
19 #define PG_INHERITS_H
20 
21 #include "catalog/genbki.h"
22 #include "catalog/pg_inherits_d.h"
23 
24 #include "nodes/pg_list.h"
25 #include "storage/lock.h"
26 
27 /* ----------------
28  * pg_inherits definition. cpp turns this into
29  * typedef struct FormData_pg_inherits
30  * ----------------
31  */
32 CATALOG(pg_inherits,2611,InheritsRelationId)
33 {
34  Oid inhrelid BKI_LOOKUP(pg_class);
35  Oid inhparent BKI_LOOKUP(pg_class);
36  int32 inhseqno;
37  bool inhdetachpending;
39 
40 /* ----------------
41  * Form_pg_inherits corresponds to a pointer to a tuple with
42  * the format of pg_inherits relation.
43  * ----------------
44  */
46 
47 DECLARE_UNIQUE_INDEX_PKEY(pg_inherits_relid_seqno_index, 2680, on pg_inherits using btree(inhrelid oid_ops, inhseqno int4_ops));
48 #define InheritsRelidSeqnoIndexId 2680
49 DECLARE_INDEX(pg_inherits_parent_index, 2187, on pg_inherits using btree(inhparent oid_ops));
50 #define InheritsParentIndexId 2187
51 
52 
53 extern List *find_inheritance_children(Oid parentrelId, LOCKMODE lockmode);
54 extern List *find_inheritance_children_extended(Oid parentrelId, bool omit_detached,
55  LOCKMODE lockmode, bool *detached_exist, TransactionId *detached_xmin);
56 
57 extern List *find_all_inheritors(Oid parentrelId, LOCKMODE lockmode,
58  List **parents);
59 extern bool has_subclass(Oid relationId);
60 extern bool has_superclass(Oid relationId);
61 extern bool typeInheritsFrom(Oid subclassTypeId, Oid superclassTypeId);
62 extern void StoreSingleInheritance(Oid relationId, Oid parentOid,
63  int32 seqNumber);
64 extern bool DeleteInheritsTuple(Oid inhrelid, Oid inhparent, bool allow_detached,
65  const char *childname);
66 extern bool PartitionHasPendingDetach(Oid partoid);
67 
68 #endif /* PG_INHERITS_H */
uint32 TransactionId
Definition: c.h:587
int LOCKMODE
Definition: lockdefs.h:26
bool has_superclass(Oid relationId)
Definition: pg_inherits.c:378
List * find_inheritance_children_extended(Oid parentrelId, bool omit_detached, LOCKMODE lockmode, bool *detached_exist, TransactionId *detached_xmin)
Definition: pg_inherits.c:83
unsigned int Oid
Definition: postgres_ext.h:31
CATALOG(pg_inherits, 2611, InheritsRelationId)
Definition: pg_inherits.h:32
signed int int32
Definition: c.h:429
bool typeInheritsFrom(Oid subclassTypeId, Oid superclassTypeId)
Definition: pg_inherits.c:407
bool PartitionHasPendingDetach(Oid partoid)
Definition: pg_inherits.c:621
bool DeleteInheritsTuple(Oid inhrelid, Oid inhparent, bool allow_detached, const char *childname)
Definition: pg_inherits.c:553
List * find_all_inheritors(Oid parentrelId, LOCKMODE lockmode, List **parents)
Definition: pg_inherits.c:256
#define BKI_LOOKUP(catalog)
Definition: genbki.h:46
DECLARE_UNIQUE_INDEX_PKEY(pg_inherits_relid_seqno_index, 2680, on pg_inherits using btree(inhrelid oid_ops, inhseqno int4_ops))
FormData_pg_inherits * Form_pg_inherits
Definition: pg_inherits.h:45
FormData_pg_inherits
Definition: pg_inherits.h:38
List * find_inheritance_children(Oid parentrelId, LOCKMODE lockmode)
Definition: pg_inherits.c:59
Definition: pg_list.h:50
void StoreSingleInheritance(Oid relationId, Oid parentOid, int32 seqNumber)
Definition: pg_inherits.c:509
DECLARE_INDEX(pg_inherits_parent_index, 2187, on pg_inherits using btree(inhparent oid_ops))
bool has_subclass(Oid relationId)
Definition: pg_inherits.c:356