Add data for WAL in pg_stat_io and backend statistics
[pgsql.git] / src / include / catalog / pg_database.h
blob54f0d38c9c9e1cd4d419b05b296b8f84875e9768
1 /*-------------------------------------------------------------------------
3 * pg_database.h
4 * definition of the "database" system catalog (pg_database)
7 * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
10 * src/include/catalog/pg_database.h
12 * NOTES
13 * The Catalog.pm module reads this file and derives schema
14 * information.
16 *-------------------------------------------------------------------------
18 #ifndef PG_DATABASE_H
19 #define PG_DATABASE_H
21 #include "catalog/genbki.h"
22 #include "catalog/pg_database_d.h" /* IWYU pragma: export */
24 /* ----------------
25 * pg_database definition. cpp turns this into
26 * typedef struct FormData_pg_database
27 * ----------------
29 CATALOG(pg_database,1262,DatabaseRelationId) BKI_SHARED_RELATION BKI_ROWTYPE_OID(1248,DatabaseRelation_Rowtype_Id) BKI_SCHEMA_MACRO
31 /* oid */
32 Oid oid;
34 /* database name */
35 NameData datname;
37 /* owner of database */
38 Oid datdba BKI_DEFAULT(POSTGRES) BKI_LOOKUP(pg_authid);
40 /* character encoding */
41 int32 encoding;
43 /* locale provider, see pg_collation.collprovider */
44 char datlocprovider;
46 /* allowed as CREATE DATABASE template? */
47 bool datistemplate;
49 /* new connections allowed? */
50 bool datallowconn;
52 /* database has login event triggers? */
53 bool dathasloginevt;
56 * Max connections allowed. Negative values have special meaning, see
57 * DATCONNLIMIT_* defines below.
59 int32 datconnlimit;
61 /* all Xids < this are frozen in this DB */
62 TransactionId datfrozenxid;
64 /* all multixacts in the DB are >= this */
65 TransactionId datminmxid;
67 /* default table space for this DB */
68 Oid dattablespace BKI_LOOKUP(pg_tablespace);
70 #ifdef CATALOG_VARLEN /* variable-length fields start here */
71 /* LC_COLLATE setting */
72 text datcollate BKI_FORCE_NOT_NULL;
74 /* LC_CTYPE setting */
75 text datctype BKI_FORCE_NOT_NULL;
77 /* ICU locale ID */
78 text datlocale;
80 /* ICU collation rules */
81 text daticurules;
83 /* provider-dependent version of collation data */
84 text datcollversion BKI_DEFAULT(_null_);
86 /* access permissions */
87 aclitem datacl[1];
88 #endif
89 } FormData_pg_database;
91 /* ----------------
92 * Form_pg_database corresponds to a pointer to a tuple with
93 * the format of pg_database relation.
94 * ----------------
96 typedef FormData_pg_database *Form_pg_database;
98 DECLARE_TOAST_WITH_MACRO(pg_database, 4177, 4178, PgDatabaseToastTable, PgDatabaseToastIndex);
100 DECLARE_UNIQUE_INDEX(pg_database_datname_index, 2671, DatabaseNameIndexId, pg_database, btree(datname name_ops));
101 DECLARE_UNIQUE_INDEX_PKEY(pg_database_oid_index, 2672, DatabaseOidIndexId, pg_database, btree(oid oid_ops));
103 MAKE_SYSCACHE(DATABASEOID, pg_database_oid_index, 4);
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.
111 DECLARE_OID_DEFINING_MACRO(Template0DbOid, 4);
112 DECLARE_OID_DEFINING_MACRO(PostgresDbOid, 5);
115 * Special values for pg_database.datconnlimit. Normal values are >= 0.
117 #define DATCONNLIMIT_UNLIMITED -1 /* no limit */
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.
124 #define DATCONNLIMIT_INVALID_DB -2
126 extern bool database_is_invalid_form(Form_pg_database datform);
127 extern bool database_is_invalid_oid(Oid dboid);
129 #endif /* PG_DATABASE_H */