PostgreSQL Source Code  git master
genbki.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * genbki.h
4  * Required include file for all POSTGRES catalog header files
5  *
6  * genbki.h defines CATALOG(), BKI_BOOTSTRAP and related macros
7  * so that the catalog header files can be read by the C compiler.
8  * (These same words are recognized by genbki.pl to build the BKI
9  * bootstrap file from these header files.)
10  *
11  *
12  * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
13  * Portions Copyright (c) 1994, Regents of the University of California
14  *
15  * src/include/catalog/genbki.h
16  *
17  *-------------------------------------------------------------------------
18  */
19 #ifndef GENBKI_H
20 #define GENBKI_H
21 
22 /* Introduces a catalog's structure definition */
23 #define CATALOG(name,oid,oidmacro) typedef struct CppConcat(FormData_,name)
24 
25 /* Options that may appear after CATALOG (on the same line) */
26 #define BKI_BOOTSTRAP
27 #define BKI_SHARED_RELATION
28 #define BKI_ROWTYPE_OID(oid,oidmacro)
29 #define BKI_SCHEMA_MACRO
30 
31 /* Options that may appear after an attribute (on the same line) */
32 #define BKI_FORCE_NULL
33 #define BKI_FORCE_NOT_NULL
34 /* Specifies a default value for a catalog field */
35 #define BKI_DEFAULT(value)
36 /* Specifies a default value for auto-generated array types */
37 #define BKI_ARRAY_DEFAULT(value)
38 /*
39  * Indicates how to perform name lookups, typically for an OID or
40  * OID-array field
41  */
42 #define BKI_LOOKUP(catalog)
43 
44 /*
45  * These lines are processed by genbki.pl to create the statements
46  * the bootstrap parser will turn into BootstrapToastTable commands.
47  * Each line specifies the system catalog that needs a toast table,
48  * the OID to assign to the toast table, and the OID to assign to the
49  * toast table's index. The reason we hard-wire these OIDs is that we
50  * need stable OIDs for shared relations, and that includes toast tables
51  * of shared relations.
52  *
53  * The macro definition is just to keep the C compiler from spitting up.
54  */
55 #define DECLARE_TOAST(name,toastoid,indexoid) extern int no_such_variable
56 
57 /*
58  * These lines processed by genbki.pl to create the statements
59  * the bootstrap parser will turn into DefineIndex calls.
60  *
61  * The keyword is DECLARE_INDEX or DECLARE_UNIQUE_INDEX. The first two
62  * arguments are the index name and OID, the rest is much like a standard
63  * 'create index' SQL command.
64  *
65  * For each index, we also provide a #define for its OID. References to
66  * the index in the C code should always use these #defines, not the actual
67  * index name (much less the numeric OID).
68  *
69  * The macro definitions are just to keep the C compiler from spitting up.
70  */
71 #define DECLARE_INDEX(name,oid,decl) extern int no_such_variable
72 #define DECLARE_UNIQUE_INDEX(name,oid,decl) extern int no_such_variable
73 
74 /* The following are never defined; they are here only for documentation. */
75 
76 /*
77  * Variable-length catalog fields (except possibly the first not nullable one)
78  * should not be visible in C structures, so they are made invisible by #ifdefs
79  * of an undefined symbol. See also the BOOTCOL_NULL_AUTO code in bootstrap.c
80  * for how this is handled.
81  */
82 #undef CATALOG_VARLEN
83 
84 /*
85  * There is code in some catalog headers that needs to be visible to clients,
86  * but we don't want clients to include the full header because of safety
87  * issues with other code in the header. To handle that, surround code that
88  * should be visible to clients with "#ifdef EXPOSE_TO_CLIENT_CODE". That
89  * instructs genbki.pl to copy the section when generating the corresponding
90  * "_d" header, which can be included by both client and backend code.
91  */
92 #undef EXPOSE_TO_CLIENT_CODE
93 
94 #endif /* GENBKI_H */