PostgreSQL Source Code  git master
pg_database.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * pg_database.h
4  * definition of the "database" system catalog (pg_database)
5  *
6  *
7  * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * src/include/catalog/pg_database.h
11  *
12  * NOTES
13  * The Catalog.pm module reads this file and derives schema
14  * information.
15  *
16  *-------------------------------------------------------------------------
17  */
18 #ifndef PG_DATABASE_H
19 #define PG_DATABASE_H
20 
21 #include "catalog/genbki.h"
22 #include "catalog/pg_database_d.h"
23 
24 /* ----------------
25  * pg_database definition. cpp turns this into
26  * typedef struct FormData_pg_database
27  * ----------------
28  */
29 CATALOG(pg_database,1262,DatabaseRelationId) BKI_SHARED_RELATION BKI_ROWTYPE_OID(1248,DatabaseRelation_Rowtype_Id) BKI_SCHEMA_MACRO
30 {
31  /* oid */
32  Oid oid;
33 
34  /* database name */
36 
37  /* owner of database */
38  Oid datdba BKI_DEFAULT(POSTGRES) BKI_LOOKUP(pg_authid);
39 
40  /* character encoding */
42 
43  /* locale provider, see pg_collation.collprovider */
45 
46  /* allowed as CREATE DATABASE template? */
48 
49  /* new connections allowed? */
51 
52  /* max connections allowed (-1=no limit) */
54 
55  /* all Xids < this are frozen in this DB */
57 
58  /* all multixacts in the DB are >= this */
60 
61  /* default table space for this DB */
62  Oid dattablespace BKI_LOOKUP(pg_tablespace);
63 
64 #ifdef CATALOG_VARLEN /* variable-length fields start here */
65  /* LC_COLLATE setting */
66  text datcollate BKI_FORCE_NOT_NULL;
67 
68  /* LC_CTYPE setting */
69  text datctype BKI_FORCE_NOT_NULL;
70 
71  /* ICU locale ID */
72  text daticulocale;
73 
74  /* ICU collation rules */
75  text daticurules;
76 
77  /* provider-dependent version of collation data */
78  text datcollversion BKI_DEFAULT(_null_);
79 
80  /* access permissions */
81  aclitem datacl[1];
82 #endif
84 
85 /* ----------------
86  * Form_pg_database corresponds to a pointer to a tuple with
87  * the format of pg_database relation.
88  * ----------------
89  */
91 
92 DECLARE_TOAST_WITH_MACRO(pg_database, 4177, 4178, PgDatabaseToastTable, PgDatabaseToastIndex);
93 
94 DECLARE_UNIQUE_INDEX(pg_database_datname_index, 2671, DatabaseNameIndexId, on pg_database using btree(datname name_ops));
95 DECLARE_UNIQUE_INDEX_PKEY(pg_database_oid_index, 2672, DatabaseOidIndexId, on pg_database using btree(oid oid_ops));
96 
97 /*
98  * pg_database.dat contains an entry for template1, but not for the template0
99  * or postgres databases, because those are created later in initdb.
100  * However, we still want to manually assign the OIDs for template0 and
101  * postgres, so declare those here.
102  */
103 DECLARE_OID_DEFINING_MACRO(Template0DbOid, 4);
104 DECLARE_OID_DEFINING_MACRO(PostgresDbOid, 5);
105 
106 #endif /* PG_DATABASE_H */
signed int int32
Definition: c.h:478
uint32 TransactionId
Definition: c.h:636
#define BKI_FORCE_NOT_NULL
Definition: genbki.h:33
#define BKI_SHARED_RELATION
Definition: genbki.h:27
#define BKI_ROWTYPE_OID(oid, oidmacro)
Definition: genbki.h:28
Oid dattablespace BKI_LOOKUP(pg_tablespace)
TransactionId datfrozenxid
Definition: pg_database.h:56
TransactionId datminmxid
Definition: pg_database.h:59
char datlocprovider
Definition: pg_database.h:44
FormData_pg_database * Form_pg_database
Definition: pg_database.h:90
DatabaseRelation_Rowtype_Id BKI_SCHEMA_MACRO
Definition: pg_database.h:30
NameData datname
Definition: pg_database.h:35
int32 encoding
Definition: pg_database.h:41
DECLARE_OID_DEFINING_MACRO(Template0DbOid, 4)
FormData_pg_database
Definition: pg_database.h:83
DECLARE_UNIQUE_INDEX_PKEY(pg_database_oid_index, 2672, DatabaseOidIndexId, on pg_database using btree(oid oid_ops))
DECLARE_UNIQUE_INDEX(pg_database_datname_index, 2671, DatabaseNameIndexId, on pg_database using btree(datname name_ops))
bool datallowconn
Definition: pg_database.h:50
DECLARE_TOAST_WITH_MACRO(pg_database, 4177, 4178, PgDatabaseToastTable, PgDatabaseToastIndex)
bool datistemplate
Definition: pg_database.h:47
int32 datconnlimit
Definition: pg_database.h:53
Oid datdba BKI_DEFAULT(POSTGRES) BKI_LOOKUP(pg_authid)
CATALOG(pg_database, 1262, DatabaseRelationId) BKI_SHARED_RELATION BKI_ROWTYPE_OID(1248
unsigned int Oid
Definition: postgres_ext.h:31
Definition: c.h:725
Definition: c.h:671