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
32{
33 /* oid */
34 Oid oid;
35
36 /* database name */
38
39 /* owner of database */
41
42 /* character encoding */
44
45 /* locale provider, see pg_collation.collprovider */
47
48 /* allowed as CREATE DATABASE template? */
50
51 /* new connections allowed? */
53
54 /* database has login event triggers? */
56
57 /*
58 * Max connections allowed. Negative values have special meaning, see
59 * DATCONNLIMIT_* defines below.
60 */
62
63 /* all Xids < this are frozen in this DB */
65
66 /* all multixacts in the DB are >= this */
68
69 /* default table space for this DB */
71
72#ifdef CATALOG_VARLEN /* variable-length fields start here */
73 /* LC_COLLATE setting */
75
76 /* LC_CTYPE setting */
78
79 /* ICU locale ID */
81
82 /* ICU collation rules */
84
85 /* provider-dependent version of collation data */
87
88 /* access permissions */
89 aclitem datacl[1];
90#endif
92
94
95/* ----------------
96 * Form_pg_database corresponds to a pointer to a tuple with
97 * the format of pg_database relation.
98 * ----------------
99 */
101
103
106
108
109/*
110 * pg_database.dat contains an entry for template1, but not for the template0
111 * or postgres databases, because those are created later in initdb.
112 * However, we still want to manually assign the OIDs for template0 and
113 * postgres, so declare those here.
114 */
117
118/*
119 * Special values for pg_database.datconnlimit. Normal values are >= 0.
120 */
121#define DATCONNLIMIT_UNLIMITED -1 /* no limit */
122
123/*
124 * A database is set to invalid partway through being dropped. Using
125 * datconnlimit=-2 for this purpose isn't particularly clean, but is
126 * backpatchable.
127 */
128#define DATCONNLIMIT_INVALID_DB -2
129
130extern Oid get_database_oid(const char *dbname, bool missing_ok);
132extern bool database_is_invalid_oid(Oid dboid);
133
134#endif /* PG_DATABASE_H */
int32_t int32
Definition c.h:554
uint32 TransactionId
Definition c.h:678
#define BEGIN_CATALOG_STRUCT
Definition genbki.h:37
#define DECLARE_UNIQUE_INDEX_PKEY(name, oid, oidmacro, tblname, decl)
Definition genbki.h:105
#define BKI_LOOKUP(catalog)
Definition genbki.h:65
#define END_CATALOG_STRUCT
Definition genbki.h:38
#define BKI_DEFAULT(value)
Definition genbki.h:54
#define DECLARE_TOAST_WITH_MACRO(name, toastoid, indexoid, toastoidmacro, indexoidmacro)
Definition genbki.h:83
#define DECLARE_UNIQUE_INDEX(name, oid, oidmacro, tblname, decl)
Definition genbki.h:104
#define BKI_FORCE_NOT_NULL
Definition genbki.h:52
#define DECLARE_OID_DEFINING_MACRO(name, oid)
Definition genbki.h:113
#define CATALOG(name, oid, oidmacro)
Definition genbki.h:42
#define MAKE_SYSCACHE(name, idxname, nbuckets)
Definition genbki.h:146
#define BKI_SHARED_RELATION
Definition genbki.h:46
#define BKI_ROWTYPE_OID(oid, oidmacro)
Definition genbki.h:47
static char * datlocale
Definition initdb.c:149
Oid get_database_oid(const char *dbname, bool missing_ok)
TransactionId datfrozenxid
Definition pg_database.h:64
TransactionId datminmxid
Definition pg_database.h:67
char datlocprovider
Definition pg_database.h:46
NameData datname
Definition pg_database.h:37
bool database_is_invalid_form(Form_pg_database datform)
END_CATALOG_STRUCT typedef FormData_pg_database * Form_pg_database
int32 encoding
Definition pg_database.h:43
FormData_pg_database
Definition pg_database.h:91
bool datallowconn
Definition pg_database.h:52
bool datistemplate
Definition pg_database.h:49
int32 datconnlimit
Definition pg_database.h:61
bool dathasloginevt
Definition pg_database.h:55
BEGIN_CATALOG_STRUCT DatabaseRelation_Rowtype_Id BKI_SCHEMA_MACRO
Definition pg_database.h:32
bool database_is_invalid_oid(Oid dboid)
unsigned int Oid
static int fb(int x)
char * dbname
Definition streamutil.c:49
Definition c.h:772
Definition c.h:718