38#include "utils/fmgroids.h"
117 elog(
ERROR,
"invalid list syntax in setconfig item");
166 errmsg(
"role with OID %u does not exist", roleid)));
188 errdetail(
"Role names starting with \"pg_\" are reserved for system roles.")));
199 roleform->rolsuper ?
"SUPERUSER" :
"NOSUPERUSER");
202 roleform->rolinherit ?
"INHERIT" :
"NOINHERIT");
205 roleform->rolcreaterole ?
"CREATEROLE" :
"NOCREATEROLE");
208 roleform->rolcreatedb ?
"CREATEDB" :
"NOCREATEDB");
211 roleform->rolcanlogin ?
"LOGIN" :
"NOLOGIN");
214 roleform->rolreplication ?
"REPLICATION" :
"NOREPLICATION");
217 roleform->rolbypassrls ?
"BYPASSRLS" :
"NOBYPASSRLS");
247 errmsg(
"timestamp out of range")));
395 memform->admin_option ?
"TRUE" :
"FALSE",
396 memform->inherit_option ?
"TRUE" :
"FALSE",
397 memform->set_option ?
"TRUE" :
"FALSE");
495 errmsg(
"tablespace with OID %u does not exist",
516 errdetail(
"Tablespace names starting with \"pg_\" are reserved for system tablespaces.")));
677 errmsg(
"database with OID %u does not exist", dbid)));
695 errmsg(
"cannot generate DDL for invalid database \"%s\"",
706 errdetail(
"DDL generation is not supported for template0 and template1.")));
735 errmsg(
"unrecognized locale provider: %c",
736 dbform->datlocprovider)));
745 if (collate !=
NULL && ctype !=
NULL &&
strcmp(collate, ctype) == 0)
790 errmsg(
"tablespace with OID %u does not exist",
792 errdetail(
"It may have been concurrently dropped.")));
815 if (
dbform->datconnlimit != -1)
824 if (
dbform->datistemplate)
833 if (!
dbform->datallowconn)
void aclcheck_error(AclResult aclerr, ObjectType objtype, const char *objectname)
AclResult object_aclcheck(Oid classid, Oid objectid, Oid roleid, AclMode mode)
AclResult pg_class_aclcheck(Oid table_oid, Oid roleid, AclMode mode)
#define DatumGetArrayTypePCopy(X)
void deconstruct_array_builtin(const ArrayType *array, Oid elmtype, Datum **elemsp, bool **nullsp, int *nelemsp)
char * get_tablespace_name(Oid spc_oid)
Oid get_tablespace_oid(const char *tablespacename, bool missing_ok)
void EncodeDateTime(struct pg_tm *tm, fsec_t fsec, bool print_tz, int tz, const char *tzn, int style, char *str)
void EncodeSpecialTimestamp(Timestamp dt, char *str)
int timestamp2tm(Timestamp dt, int *tzp, struct pg_tm *tm, fsec_t *fsec, const char **tzn, pg_tz *attimezone)
#define CStringGetTextDatum(s)
#define TextDatumGetCString(d)
#define pg_attribute_printf(f, a)
#define OidIsValid(objectId)
bool IsReservedName(const char *name)
#define TIMESTAMP_NOT_FINITE(j)
bool database_is_invalid_form(Form_pg_database datform)
Datum pg_get_database_ddl(PG_FUNCTION_ARGS)
static List * pg_get_tablespace_ddl_internal(Oid tsid, bool pretty, bool no_owner)
Datum pg_get_tablespace_ddl_oid(PG_FUNCTION_ARGS)
static List * pg_get_role_ddl_internal(Oid roleid, bool pretty, bool memberships)
static List * pg_get_database_ddl_internal(Oid dbid, bool pretty, bool no_owner, bool no_tablespace)
Datum pg_get_tablespace_ddl_name(PG_FUNCTION_ARGS)
static void append_ddl_option(StringInfo buf, bool pretty, int indent, const char *fmt,...) pg_attribute_printf(4
static Datum pg_get_tablespace_ddl_srf(FunctionCallInfo fcinfo, Oid tsid)
static void static void append_guc_value(StringInfo buf, const char *name, const char *value)
Datum pg_get_role_ddl(PG_FUNCTION_ARGS)
int errcode(int sqlerrcode)
int errdetail(const char *fmt,...) pg_attribute_printf(1
#define ereport(elevel,...)
#define PG_GETARG_NAME(n)
#define PG_GETARG_BOOL(n)
#define SRF_IS_FIRSTCALL()
#define SRF_PERCALL_SETUP()
#define SRF_RETURN_NEXT(_funcctx, _result)
#define SRF_FIRSTCALL_INIT()
#define SRF_RETURN_DONE(_funcctx)
void systable_endscan(SysScanDesc sysscan)
HeapTuple systable_getnext(SysScanDesc sysscan)
SysScanDesc systable_beginscan(Relation heapRelation, Oid indexId, bool indexOK, Snapshot snapshot, int nkeys, ScanKey key)
int GetConfigOptionFlags(const char *name, bool missing_ok)
#define HeapTupleIsValid(tuple)
static Datum heap_getattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)
static void * GETSTRUCT(const HeapTupleData *tuple)
List * lappend(List *list, void *datum)
void list_free(List *list)
void list_free_deep(List *list)
char * get_database_name(Oid dbid)
char * pstrdup(const char *in)
void pfree(void *pointer)
char * GetUserNameFromId(Oid roleid, bool noerr)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
END_CATALOG_STRUCT typedef FormData_pg_auth_members * Form_pg_auth_members
END_CATALOG_STRUCT typedef FormData_pg_authid * Form_pg_authid
END_CATALOG_STRUCT typedef FormData_pg_database * Form_pg_database
END_CATALOG_STRUCT typedef FormData_pg_db_role_setting * Form_pg_db_role_setting
static int list_length(const List *l)
#define foreach_ptr(type, var, lst)
static void * list_nth(const List *list, int n)
char * get_tablespace_location(Oid tablespaceOid)
END_CATALOG_STRUCT typedef FormData_pg_tablespace * Form_pg_tablespace
static char buf[DEFAULT_XLOG_SEG_SIZE]
#define pg_encoding_to_char
int pg_strcasecmp(const char *s1, const char *s2)
static Datum ObjectIdGetDatum(Oid X)
char * quote_literal_cstr(const char *rawstr)
#define RelationGetDescr(relation)
#define PG_TBLSPC_DIR_SLASH
const char * quote_identifier(const char *ident)
void get_reloptions(StringInfo buf, Datum reloptions)
void ScanKeyInit(ScanKey entry, AttrNumber attributeNumber, StrategyNumber strategy, RegProcedure procedure, Datum argument)
#define BTEqualStrategyNumber
int appendStringInfoVA(StringInfo str, const char *fmt, va_list args)
void resetStringInfo(StringInfo str)
void appendStringInfo(StringInfo str, const char *fmt,...)
void enlargeStringInfo(StringInfo str, int needed)
void appendStringInfoSpaces(StringInfo str, int count)
void appendStringInfoString(StringInfo str, const char *s)
void appendStringInfoChar(StringInfo str, char ch)
void initStringInfo(StringInfo str)
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache1(SysCacheIdentifier cacheId, Datum key1)
Datum SysCacheGetAttr(SysCacheIdentifier cacheId, HeapTuple tup, AttrNumber attributeNumber, bool *isNull)
void table_close(Relation relation, LOCKMODE lockmode)
Relation table_open(Oid relationId, LOCKMODE lockmode)
static TimestampTz DatumGetTimestampTz(Datum X)
bool SplitGUCList(char *rawstring, char separator, List **namelist)