PostgreSQL Source Code  git master
pg_database.h File Reference
#include "catalog/genbki.h"
#include "catalog/pg_database_d.h"
Include dependency graph for pg_database.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define DATCONNLIMIT_UNLIMITED   -1 /* no limit */
 
#define DATCONNLIMIT_INVALID_DB   -2
 

Typedefs

typedef FormData_pg_databaseForm_pg_database
 

Functions

 CATALOG (pg_database, 1262, DatabaseRelationId) BKI_SHARED_RELATION BKI_ROWTYPE_OID(1248
 
Oid datdba BKI_DEFAULT (POSTGRES) BKI_LOOKUP(pg_authid)
 
Oid dattablespace BKI_LOOKUP (pg_tablespace)
 
 DECLARE_TOAST_WITH_MACRO (pg_database, 4177, 4178, PgDatabaseToastTable, PgDatabaseToastIndex)
 
 DECLARE_UNIQUE_INDEX (pg_database_datname_index, 2671, DatabaseNameIndexId, pg_database, btree(datname name_ops))
 
 DECLARE_UNIQUE_INDEX_PKEY (pg_database_oid_index, 2672, DatabaseOidIndexId, pg_database, btree(oid oid_ops))
 
 MAKE_SYSCACHE (DATABASEOID, pg_database_oid_index, 4)
 
 DECLARE_OID_DEFINING_MACRO (Template0DbOid, 4)
 
 DECLARE_OID_DEFINING_MACRO (PostgresDbOid, 5)
 
bool database_is_invalid_form (Form_pg_database datform)
 
bool database_is_invalid_oid (Oid dboid)
 

Variables

DatabaseRelation_Rowtype_Id BKI_SCHEMA_MACRO
 
NameData datname
 
int32 encoding
 
char datlocprovider
 
bool datistemplate
 
bool datallowconn
 
bool dathasloginevt
 
int32 datconnlimit
 
TransactionId datfrozenxid
 
TransactionId datminmxid
 
 FormData_pg_database
 

Macro Definition Documentation

◆ DATCONNLIMIT_INVALID_DB

#define DATCONNLIMIT_INVALID_DB   -2

Definition at line 124 of file pg_database.h.

◆ DATCONNLIMIT_UNLIMITED

#define DATCONNLIMIT_UNLIMITED   -1 /* no limit */

Definition at line 117 of file pg_database.h.

Typedef Documentation

◆ Form_pg_database

Definition at line 96 of file pg_database.h.

Function Documentation

◆ BKI_DEFAULT()

Oid datdba BKI_DEFAULT ( POSTGRES  )

◆ BKI_LOOKUP()

Oid dattablespace BKI_LOOKUP ( pg_tablespace  )

◆ CATALOG()

CATALOG ( pg_database  ,
1262  ,
DatabaseRelationId   
)

◆ database_is_invalid_form()

bool database_is_invalid_form ( Form_pg_database  datform)

Definition at line 3178 of file dbcommands.c.

3179 {
3180  return datform->datconnlimit == DATCONNLIMIT_INVALID_DB;
3181 }
#define DATCONNLIMIT_INVALID_DB
Definition: pg_database.h:124

References DATCONNLIMIT_INVALID_DB.

Referenced by AlterDatabase(), database_is_invalid_oid(), get_database_list(), InitPostgres(), and vac_truncate_clog().

◆ database_is_invalid_oid()

bool database_is_invalid_oid ( Oid  dboid)

Definition at line 3188 of file dbcommands.c.

3189 {
3190  HeapTuple dbtup;
3191  Form_pg_database dbform;
3192  bool invalid;
3193 
3194  dbtup = SearchSysCache1(DATABASEOID, ObjectIdGetDatum(dboid));
3195  if (!HeapTupleIsValid(dbtup))
3196  elog(ERROR, "cache lookup failed for database %u", dboid);
3197  dbform = (Form_pg_database) GETSTRUCT(dbtup);
3198 
3200 
3201  ReleaseSysCache(dbtup);
3202 
3203  return invalid;
3204 }
bool database_is_invalid_form(Form_pg_database datform)
Definition: dbcommands.c:3178
#define ERROR
Definition: elog.h:39
#define elog(elevel,...)
Definition: elog.h:224
#define HeapTupleIsValid(tuple)
Definition: htup.h:78
#define GETSTRUCT(TUP)
Definition: htup_details.h:653
invalidindex index d is invalid
Definition: isn.c:134
FormData_pg_database * Form_pg_database
Definition: pg_database.h:96
static Datum ObjectIdGetDatum(Oid X)
Definition: postgres.h:252
void ReleaseSysCache(HeapTuple tuple)
Definition: syscache.c:266
HeapTuple SearchSysCache1(int cacheId, Datum key1)
Definition: syscache.c:218

References database_is_invalid_form(), elog, ERROR, GETSTRUCT, HeapTupleIsValid, invalid, ObjectIdGetDatum(), ReleaseSysCache(), and SearchSysCache1().

Referenced by createdb().

◆ DECLARE_OID_DEFINING_MACRO() [1/2]

DECLARE_OID_DEFINING_MACRO ( PostgresDbOid  ,
 
)

◆ DECLARE_OID_DEFINING_MACRO() [2/2]

DECLARE_OID_DEFINING_MACRO ( Template0DbOid  ,
 
)

◆ DECLARE_TOAST_WITH_MACRO()

DECLARE_TOAST_WITH_MACRO ( pg_database  ,
4177  ,
4178  ,
PgDatabaseToastTable  ,
PgDatabaseToastIndex   
)

◆ DECLARE_UNIQUE_INDEX()

DECLARE_UNIQUE_INDEX ( pg_database_datname_index  ,
2671  ,
DatabaseNameIndexId  ,
pg_database  ,
btree(datname name_ops)   
)

◆ DECLARE_UNIQUE_INDEX_PKEY()

DECLARE_UNIQUE_INDEX_PKEY ( pg_database_oid_index  ,
2672  ,
DatabaseOidIndexId  ,
pg_database  ,
btree(oid oid_ops)   
)

◆ MAKE_SYSCACHE()

MAKE_SYSCACHE ( DATABASEOID  ,
pg_database_oid_index  ,
 
)

Variable Documentation

◆ BKI_SCHEMA_MACRO

DatabaseRelation_Rowtype_Id BKI_SCHEMA_MACRO
Initial value:
{
Oid oid
unsigned int Oid
Definition: postgres_ext.h:31

Definition at line 29 of file pg_database.h.

◆ datallowconn

bool datallowconn

Definition at line 50 of file pg_database.h.

Referenced by check_proper_datallowconn(), and set_frozenxids().

◆ datconnlimit

int32 datconnlimit

Definition at line 59 of file pg_database.h.

Referenced by dumpDatabase().

◆ datfrozenxid

TransactionId datfrozenxid

Definition at line 62 of file pg_database.h.

Referenced by vac_truncate_clog().

◆ dathasloginevt

bool dathasloginevt

Definition at line 53 of file pg_database.h.

◆ datistemplate

bool datistemplate

Definition at line 47 of file pg_database.h.

Referenced by dumpDatabase().

◆ datlocprovider

char datlocprovider

◆ datminmxid

TransactionId datminmxid

Definition at line 65 of file pg_database.h.

Referenced by vac_truncate_clog().

◆ datname

◆ encoding

int32 encoding

Definition at line 41 of file pg_database.h.

Referenced by append_btree_pattern(), append_database_pattern(), append_heap_pattern(), append_relation_pattern(), append_relation_pattern_helper(), append_schema_pattern(), appendReloptionsArray(), appendStringLiteral(), ascii(), assign_client_encoding(), builtin_validate_locale(), cache_locale_time(), cache_single_string(), CATALOG(), check_client_encoding(), check_encoding_locale_matches(), chr(), createdb(), db_encoding_convert(), dumpDatabase(), entry_alloc(), exec_command_encoding(), get_encoding_name_for_icu(), get_json_format(), getJsonEncodingConst(), is_encoding_supported_by_icu(), iso8859_to_utf8(), latin2mic(), latin2mic_with_table(), LocalToUtf(), lookup_collation(), main(), makeJsonByteaToTextConversion(), makeJsonFormat(), makeJsonLexContextCstringLen(), makeJsonLexContextIncremental(), mbvalidate(), mic2latin(), mic2latin_with_table(), patternToSQLRegex(), pg_any_to_server(), pg_encoding_dsplen(), pg_encoding_max_length(), pg_encoding_max_length_sql(), pg_encoding_mb2wchar_with_len(), pg_encoding_mbcliplen(), pg_encoding_mblen(), pg_encoding_mblen_bounded(), pg_encoding_to_char(), PG_encoding_to_char(), pg_encoding_verifymbchar(), pg_encoding_verifymbstr(), pg_encoding_wchar2mb_with_len(), pg_server_to_any(), pg_valid_server_encoding_id(), pg_verify_mbstr(), pg_verify_mbstr_len(), pg_wcsformat(), pg_wcssize(), pg_wcswidth(), PGLC_localeconv(), pgss_store(), PQdsplen(), PQenv2encoding(), PQescapeStringInternal(), PQmblen(), PQmblenBounded(), PQsetClientEncoding(), PrepareClientEncoding(), print_aligned_text(), print_aligned_vertical(), processEncodingEntry(), quote_if_needed(), report_invalid_encoding(), reportErrorPosition(), SetClientEncoding(), SetDatabaseEncoding(), SetMessageEncoding(), splitTableColumnsSpec(), strip_quotes(), strlen_max_width(), strtokx(), utf8_to_iso8859(), utf8_to_win(), UtfToLocal(), win_to_utf8(), and xml_recv().

◆ FormData_pg_database

FormData_pg_database

Definition at line 89 of file pg_database.h.

Referenced by vac_truncate_clog().