1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>52.15. pg_database</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="catalog-pg-conversion.html" title="52.14. pg_conversion" /><link rel="next" href="catalog-pg-db-role-setting.html" title="52.16. pg_db_role_setting" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">52.15. <code class="structname">pg_database</code></th></tr><tr><td width="10%" align="left"><a accesskey="p" href="catalog-pg-conversion.html" title="52.14. pg_conversion">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="catalogs.html" title="Chapter 52. System Catalogs">Up</a></td><th width="60%" align="center">Chapter 52. System Catalogs</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="catalog-pg-db-role-setting.html" title="52.16. pg_db_role_setting">Next</a></td></tr></table><hr /></div><div class="sect1" id="CATALOG-PG-DATABASE"><div class="titlepage"><div><div><h2 class="title" style="clear: both">52.15. <code class="structname">pg_database</code> <a href="#CATALOG-PG-DATABASE" class="id_link">#</a></h2></div></div></div><a id="id-1.10.4.17.2" class="indexterm"></a><p>
3 The catalog <code class="structname">pg_database</code> stores information about
4 the available databases. Databases are created with the <a class="link" href="sql-createdatabase.html" title="CREATE DATABASE"><code class="command">CREATE DATABASE</code></a> command.
5 Consult <a class="xref" href="managing-databases.html" title="Chapter 22. Managing Databases">Chapter 22</a> for details about the meaning
6 of some of the parameters.
8 Unlike most system catalogs, <code class="structname">pg_database</code>
9 is shared across all databases of a cluster: there is only one
10 copy of <code class="structname">pg_database</code> per cluster, not
12 </p><div class="table" id="id-1.10.4.17.5"><p class="title"><strong>Table 52.15. <code class="structname">pg_database</code> Columns</strong></p><div class="table-contents"><table class="table" summary="pg_database Columns" border="1"><colgroup><col /></colgroup><thead><tr><th class="catalog_table_entry"><p class="column_definition">
17 </p></th></tr></thead><tbody><tr><td class="catalog_table_entry"><p class="column_definition">
18 <code class="structfield">oid</code> <code class="type">oid</code>
22 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
23 <code class="structfield">datname</code> <code class="type">name</code>
27 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
28 <code class="structfield">datdba</code> <code class="type">oid</code>
29 (references <a class="link" href="catalog-pg-authid.html" title="52.8. pg_authid"><code class="structname">pg_authid</code></a>.<code class="structfield">oid</code>)
32 Owner of the database, usually the user who created it
33 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
34 <code class="structfield">encoding</code> <code class="type">int4</code>
37 Character encoding for this database
38 (<a class="link" href="functions-info.html#PG-ENCODING-TO-CHAR"><code class="function">pg_encoding_to_char()</code></a> can translate
39 this number to the encoding name)
40 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
41 <code class="structfield">datlocprovider</code> <code class="type">char</code>
44 Locale provider for this database: <code class="literal">b</code> = builtin,
45 <code class="literal">c</code> = libc, <code class="literal">i</code> = icu </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
46 <code class="structfield">datistemplate</code> <code class="type">bool</code>
49 If true, then this database can be cloned by
50 any user with <code class="literal">CREATEDB</code> privileges;
51 if false, then only superusers or the owner of
52 the database can clone it.
53 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
54 <code class="structfield">datallowconn</code> <code class="type">bool</code>
57 If false then no one can connect to this database. This is
58 used to protect the <code class="literal">template0</code> database from being altered.
59 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
60 <code class="structfield">dathasloginevt</code> <code class="type">bool</code>
63 Indicates that there are login event triggers defined for this database.
64 This flag is used to avoid extra lookups on the
65 <code class="structname">pg_event_trigger</code> table during each backend
66 startup. This flag is used internally by <span class="productname">PostgreSQL</span>
67 and should not be manually altered or read for monitoring purposes.
68 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
69 <code class="structfield">datconnlimit</code> <code class="type">int4</code>
72 Sets maximum number of concurrent connections that can be made
73 to this database. -1 means no limit, -2 indicates the database is
75 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
76 <code class="structfield">datfrozenxid</code> <code class="type">xid</code>
79 All transaction IDs before this one have been replaced with a permanent
80 (<span class="quote">“<span class="quote">frozen</span>”</span>) transaction ID in this database. This is used to
81 track whether the database needs to be vacuumed in order to prevent
82 transaction ID wraparound or to allow <code class="literal">pg_xact</code> to be shrunk.
83 It is the minimum of the per-table
84 <a class="link" href="catalog-pg-class.html" title="52.11. pg_class"><code class="structname">pg_class</code></a>.<code class="structfield">relfrozenxid</code> values.
85 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
86 <code class="structfield">datminmxid</code> <code class="type">xid</code>
89 All multixact IDs before this one have been replaced with a
90 transaction ID in this database. This is used to
91 track whether the database needs to be vacuumed in order to prevent
92 multixact ID wraparound or to allow <code class="literal">pg_multixact</code> to be shrunk.
93 It is the minimum of the per-table
94 <a class="link" href="catalog-pg-class.html" title="52.11. pg_class"><code class="structname">pg_class</code></a>.<code class="structfield">relminmxid</code> values.
95 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
96 <code class="structfield">dattablespace</code> <code class="type">oid</code>
97 (references <a class="link" href="catalog-pg-tablespace.html" title="52.56. pg_tablespace"><code class="structname">pg_tablespace</code></a>.<code class="structfield">oid</code>)
100 The default tablespace for the database.
101 Within this database, all tables for which
102 <a class="link" href="catalog-pg-class.html" title="52.11. pg_class"><code class="structname">pg_class</code></a>.<code class="structfield">reltablespace</code> is zero
103 will be stored in this tablespace; in particular, all the non-shared
104 system catalogs will be there.
105 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
106 <code class="structfield">datcollate</code> <code class="type">text</code>
109 LC_COLLATE for this database
110 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
111 <code class="structfield">datctype</code> <code class="type">text</code>
114 LC_CTYPE for this database
115 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
116 <code class="structfield">datlocale</code> <code class="type">text</code>
119 Collation provider locale name for this database. If the
120 provider is <code class="literal">libc</code>,
121 <code class="structfield">datlocale</code> is <code class="literal">NULL</code>;
122 <code class="structfield">datcollate</code> and
123 <code class="structfield">datctype</code> are used instead.
124 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
125 <code class="structfield">daticurules</code> <code class="type">text</code>
128 ICU collation rules for this database
129 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
130 <code class="structfield">datcollversion</code> <code class="type">text</code>
133 Provider-specific version of the collation. This is recorded when the
134 database is created and then checked when it is used, to detect
135 changes in the collation definition that could lead to data corruption.
136 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
137 <code class="structfield">datacl</code> <code class="type">aclitem[]</code>
140 Access privileges; see <a class="xref" href="ddl-priv.html" title="5.8. Privileges">Section 5.8</a> for details
141 </p></td></tr></tbody></table></div></div><br class="table-break" /></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="catalog-pg-conversion.html" title="52.14. pg_conversion">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="catalogs.html" title="Chapter 52. System Catalogs">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="catalog-pg-db-role-setting.html" title="52.16. pg_db_role_setting">Next</a></td></tr><tr><td width="40%" align="left" valign="top">52.14. <code class="structname">pg_conversion</code> </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 52.16. <code class="structname">pg_db_role_setting</code></td></tr></table></div></body></html>