|
PostgreSQL Source Code git master
|
#include "postgres.h"#include "access/genam.h"#include "access/htup_details.h"#include "access/table.h"#include "catalog/pg_auth_members.h"#include "catalog/pg_authid.h"#include "catalog/pg_collation.h"#include "catalog/pg_database.h"#include "catalog/pg_db_role_setting.h"#include "catalog/pg_tablespace.h"#include "commands/tablespace.h"#include "common/relpath.h"#include "funcapi.h"#include "mb/pg_wchar.h"#include "miscadmin.h"#include "utils/acl.h"#include "utils/array.h"#include "utils/builtins.h"#include "utils/datetime.h"#include "utils/fmgroids.h"#include "utils/guc.h"#include "utils/lsyscache.h"#include "utils/pg_locale.h"#include "utils/rel.h"#include "utils/ruleutils.h"#include "utils/syscache.h"#include "utils/timestamp.h"#include "utils/varlena.h"
Go to the source code of this file.
Data Structures | |
| struct | DdlOption |
Typedefs | |
| typedef struct DdlOption | DdlOption |
Enumerations | |
| enum | DdlOptType { DDL_OPT_BOOL , DDL_OPT_TEXT , DDL_OPT_INT } |
Functions | |
| static void | parse_ddl_options (FunctionCallInfo fcinfo, int variadic_start, DdlOption *opts, int nopts) |
| static void | append_ddl_option (StringInfo buf, bool pretty, int indent, const char *fmt,...) pg_attribute_printf(4 |
| static void static void | append_guc_value (StringInfo buf, const char *name, const char *value) |
| static List * | pg_get_role_ddl_internal (Oid roleid, bool pretty, bool memberships) |
| static List * | pg_get_tablespace_ddl_internal (Oid tsid, bool pretty, bool no_owner) |
| static Datum | pg_get_tablespace_ddl_srf (FunctionCallInfo fcinfo, Oid tsid, bool isnull) |
| static List * | pg_get_database_ddl_internal (Oid dbid, bool pretty, bool no_owner, bool no_tablespace) |
| Datum | pg_get_role_ddl (PG_FUNCTION_ARGS) |
| Datum | pg_get_tablespace_ddl_oid (PG_FUNCTION_ARGS) |
| Datum | pg_get_tablespace_ddl_name (PG_FUNCTION_ARGS) |
| Datum | pg_get_database_ddl (PG_FUNCTION_ARGS) |
| Enumerator | |
|---|---|
| DDL_OPT_BOOL | |
| DDL_OPT_TEXT | |
| DDL_OPT_INT | |
Definition at line 50 of file ddlutils.c.
|
static |
Definition at line 234 of file ddlutils.c.
References appendStringInfoChar(), appendStringInfoSpaces(), appendStringInfoVA(), buf, enlargeStringInfo(), and fb().
Referenced by pg_get_database_ddl_internal(), pg_get_role_ddl_internal(), and pg_get_tablespace_ddl_internal().
Definition at line 271 of file ddlutils.c.
References appendStringInfoString(), buf, elog, ERROR, fb(), foreach_ptr, GetConfigOptionFlags(), GUC_LIST_QUOTE, list_free(), name, NIL, pfree(), pstrdup(), quote_literal_cstr(), SplitGUCList(), and value.
Referenced by pg_get_database_ddl_internal(), and pg_get_role_ddl_internal().
|
static |
Definition at line 102 of file ddlutils.c.
References DdlOption::boolval, DDL_OPT_BOOL, DDL_OPT_INT, DDL_OPT_TEXT, ereport, errcode(), errhint(), errmsg, ERROR, extract_variadic_args(), fb(), i, DdlOption::intval, DdlOption::isset, j, name, opts, parse_bool(), pfree(), PG_INT32_MAX, pg_strcasecmp(), TextDatumGetCString, DdlOption::textval, type, DdlOption::type, types, and val.
Referenced by pg_get_database_ddl(), pg_get_role_ddl(), and pg_get_tablespace_ddl_srf().
| Datum pg_get_database_ddl | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1117 of file ddlutils.c.
References CStringGetTextDatum, DDL_OPT_BOOL, fb(), lengthof, list_free_deep(), list_length(), list_nth(), MemoryContextSwitchTo(), opts, parse_ddl_options(), PG_ARGISNULL, pg_get_database_ddl_internal(), PG_GETARG_OID, SRF_FIRSTCALL_INIT, SRF_IS_FIRSTCALL, SRF_PERCALL_SETUP, SRF_RETURN_DONE, SRF_RETURN_NEXT, and stmt.
|
static |
Definition at line 857 of file ddlutils.c.
References AccessShareLock, ACL_CONNECT, aclcheck_error(), ACLCHECK_OK, append_ddl_option(), append_guc_value(), appendStringInfo(), appendStringInfoChar(), BTEqualStrategyNumber, buf, DatumGetArrayTypeP, dbname, deconstruct_array_builtin(), encoding, ereport, errcode(), errdetail(), errmsg, ERROR, fb(), Form_pg_database, get_database_name(), get_tablespace_name(), GETSTRUCT(), GetUserId(), GetUserNameFromId(), heap_getattr(), HeapTupleIsValid, i, initStringInfo(), InvalidOid, lappend(), NameStr, NIL, object_aclcheck(), OBJECT_DATABASE, ObjectIdGetDatum(), OidIsValid, pfree(), pg_encoding_to_char, pg_strcasecmp(), pstrdup(), quote_identifier(), quote_literal_cstr(), RelationGetDescr, ReleaseSysCache(), resetStringInfo(), ScanKeyInit(), SearchSysCache1(), SysCacheGetAttr(), systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), table_open(), and TextDatumGetCString.
Referenced by pg_get_database_ddl().
| Datum pg_get_role_ddl | ( | PG_FUNCTION_ARGS | ) |
Definition at line 596 of file ddlutils.c.
References CStringGetTextDatum, DDL_OPT_BOOL, fb(), lengthof, list_free_deep(), list_length(), list_nth(), MemoryContextSwitchTo(), opts, parse_ddl_options(), PG_ARGISNULL, pg_get_role_ddl_internal(), PG_GETARG_OID, SRF_FIRSTCALL_INIT, SRF_IS_FIRSTCALL, SRF_PERCALL_SETUP, SRF_RETURN_DONE, SRF_RETURN_NEXT, and stmt.
Definition at line 318 of file ddlutils.c.
References AccessShareLock, ACL_SELECT, ACLCHECK_OK, append_ddl_option(), append_guc_value(), appendStringInfo(), appendStringInfoChar(), BTEqualStrategyNumber, buf, datname, DatumGetArrayTypeP, DatumGetTimestampTz(), deconstruct_array_builtin(), EncodeDateTime(), EncodeSpecialTimestamp(), ereport, errcode(), errdetail(), errmsg, ERROR, fb(), Form_pg_auth_members, Form_pg_authid, Form_pg_db_role_setting, get_database_name(), GETSTRUCT(), GetUserId(), GetUserNameFromId(), heap_getattr(), HeapTupleIsValid, i, initStringInfo(), IsReservedName(), lappend(), MAXDATELEN, NameStr, NIL, ObjectIdGetDatum(), OidIsValid, pfree(), pg_class_aclcheck(), pstrdup(), quote_identifier(), quote_literal_cstr(), RelationGetDescr, ReleaseSysCache(), resetStringInfo(), rolname, ScanKeyInit(), SearchSysCache1(), SysCacheGetAttr(), systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), table_open(), TextDatumGetCString, timestamp2tm(), TIMESTAMP_NOT_FINITE, tm, and USE_ISO_DATES.
Referenced by pg_get_role_ddl().
Definition at line 658 of file ddlutils.c.
References ACL_SELECT, aclcheck_error(), ACLCHECK_NO_PRIV, ACLCHECK_OK, append_ddl_option(), appendStringInfo(), appendStringInfoChar(), appendStringInfoString(), buf, ereport, errcode(), errdetail(), errmsg, ERROR, fb(), Form_pg_tablespace, get_reloptions(), get_tablespace_location(), GETSTRUCT(), GetUserId(), GetUserNameFromId(), HeapTupleIsValid, initStringInfo(), IsReservedName(), lappend(), NameStr, NIL, OBJECT_TABLESPACE, ObjectIdGetDatum(), pfree(), pg_class_aclcheck(), PG_TBLSPC_DIR_SLASH, pstrdup(), quote_identifier(), quote_literal_cstr(), ReleaseSysCache(), resetStringInfo(), SearchSysCache1(), and SysCacheGetAttr().
Referenced by pg_get_tablespace_ddl_srf().
| Datum pg_get_tablespace_ddl_name | ( | PG_FUNCTION_ARGS | ) |
Definition at line 831 of file ddlutils.c.
References fb(), get_tablespace_oid(), InvalidOid, NameStr, PG_ARGISNULL, pg_get_tablespace_ddl_srf(), and PG_GETARG_NAME.
| Datum pg_get_tablespace_ddl_oid | ( | PG_FUNCTION_ARGS | ) |
Definition at line 814 of file ddlutils.c.
References InvalidOid, PG_ARGISNULL, pg_get_tablespace_ddl_srf(), and PG_GETARG_OID.
|
static |
Definition at line 758 of file ddlutils.c.
References CStringGetTextDatum, DDL_OPT_BOOL, fb(), lengthof, list_free_deep(), list_length(), list_nth(), MemoryContextSwitchTo(), opts, parse_ddl_options(), pg_get_tablespace_ddl_internal(), SRF_FIRSTCALL_INIT, SRF_IS_FIRSTCALL, SRF_PERCALL_SETUP, SRF_RETURN_DONE, SRF_RETURN_NEXT, and stmt.
Referenced by pg_get_tablespace_ddl_name(), and pg_get_tablespace_ddl_oid().