PostgreSQL Source Code git master
Loading...
Searching...
No Matches
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-2026, 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" /* IWYU pragma: export */
23
24/* ----------------
25 * pg_database definition. cpp turns this into
26 * typedef struct FormData_pg_database
27 * ----------------
28 */
30{
31 /* oid */
32 Oid oid;
33
34 /* database name */
36
37 /* owner of database */
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 /* database has login event triggers? */
54
55 /*
56 * Max connections allowed. Negative values have special meaning, see
57 * DATCONNLIMIT_* defines below.
58 */
60
61 /* all Xids < this are frozen in this DB */
63
64 /* all multixacts in the DB are >= this */
66
67 /* default table space for this DB */
69
70#ifdef CATALOG_VARLEN /* variable-length fields start here */
71 /* LC_COLLATE setting */
73
74 /* LC_CTYPE setting */
76
77 /* ICU locale ID */
79
80 /* ICU collation rules */
82
83 /* provider-dependent version of collation data */
85
86 /* access permissions */
87 aclitem datacl[1];
88#endif
90
91/* ----------------
92 * Form_pg_database corresponds to a pointer to a tuple with
93 * the format of pg_database relation.
94 * ----------------
95 */
97
99
102
104
105/*
106 * pg_database.dat contains an entry for template1, but not for the template0
107 * or postgres databases, because those are created later in initdb.
108 * However, we still want to manually assign the OIDs for template0 and
109 * postgres, so declare those here.
110 */
113
114/*
115 * Special values for pg_database.datconnlimit. Normal values are >= 0.
116 */
117#define DATCONNLIMIT_UNLIMITED -1 /* no limit */
118
119/*
120 * A database is set to invalid partway through being dropped. Using
121 * datconnlimit=-2 for this purpose isn't particularly clean, but is
122 * backpatchable.
123 */
124#define DATCONNLIMIT_INVALID_DB -2
125
126extern Oid get_database_oid(const char *dbname, bool missing_ok);
128extern bool database_is_invalid_oid(Oid dboid);
129
130#endif /* PG_DATABASE_H */
int32_t int32
Definition c.h:542
uint32 TransactionId
Definition c.h:666
#define DECLARE_UNIQUE_INDEX_PKEY(name, oid, oidmacro, tblname, decl)
Definition genbki.h:86
#define BKI_LOOKUP(catalog)
Definition genbki.h:46
#define BKI_DEFAULT(value)
Definition genbki.h:35
#define DECLARE_TOAST_WITH_MACRO(name, toastoid, indexoid, toastoidmacro, indexoidmacro)
Definition genbki.h:64
#define DECLARE_UNIQUE_INDEX(name, oid, oidmacro, tblname, decl)
Definition genbki.h:85
#define BKI_FORCE_NOT_NULL
Definition genbki.h:33
#define DECLARE_OID_DEFINING_MACRO(name, oid)
Definition genbki.h:94
#define CATALOG(name, oid, oidmacro)
Definition genbki.h:23
#define MAKE_SYSCACHE(name, idxname, nbuckets)
Definition genbki.h:127
#define BKI_SHARED_RELATION
Definition genbki.h:27
#define BKI_ROWTYPE_OID(oid, oidmacro)
Definition genbki.h:28
static char * datlocale
Definition initdb.c:149
Oid get_database_oid(const char *dbname, bool missing_ok)
TransactionId datfrozenxid
Definition pg_database.h:62
TransactionId datminmxid
Definition pg_database.h:65
char datlocprovider
Definition pg_database.h:44
FormData_pg_database * Form_pg_database
Definition pg_database.h:96
DatabaseRelation_Rowtype_Id BKI_SCHEMA_MACRO
Definition pg_database.h:30
NameData datname
Definition pg_database.h:35
bool database_is_invalid_form(Form_pg_database datform)
int32 encoding
Definition pg_database.h:41
FormData_pg_database
Definition pg_database.h:89
bool datallowconn
Definition pg_database.h:50
bool datistemplate
Definition pg_database.h:47
int32 datconnlimit
Definition pg_database.h:59
bool dathasloginevt
Definition pg_database.h:53
bool database_is_invalid_oid(Oid dboid)
unsigned int Oid
static int fb(int x)
char * dbname
Definition streamutil.c:49
Definition c.h:760
Definition c.h:706