PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <dirent.h>
#include <limits.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <unistd.h>
#include "access/genam.h"
#include "access/htup_details.h"
#include "access/relation.h"
#include "access/table.h"
#include "access/xact.h"
#include "catalog/catalog.h"
#include "catalog/dependency.h"
#include "catalog/indexing.h"
#include "catalog/namespace.h"
#include "catalog/objectaccess.h"
#include "catalog/pg_authid.h"
#include "catalog/pg_collation.h"
#include "catalog/pg_database.h"
#include "catalog/pg_depend.h"
#include "catalog/pg_extension.h"
#include "catalog/pg_namespace.h"
#include "catalog/pg_type.h"
#include "commands/alter.h"
#include "commands/comment.h"
#include "commands/defrem.h"
#include "commands/extension.h"
#include "commands/schemacmds.h"
#include "funcapi.h"
#include "mb/pg_wchar.h"
#include "miscadmin.h"
#include "nodes/queryjumble.h"
#include "storage/fd.h"
#include "tcop/utility.h"
#include "utils/acl.h"
#include "utils/builtins.h"
#include "utils/conffiles.h"
#include "utils/fmgroids.h"
#include "utils/lsyscache.h"
#include "utils/memutils.h"
#include "utils/rel.h"
#include "utils/snapmgr.h"
#include "utils/syscache.h"
#include "utils/varlena.h"
Go to the source code of this file.
Data Structures | |
struct | ExtensionControlFile |
struct | ExtensionVersionInfo |
struct | script_error_callback_arg |
Typedefs | |
typedef struct ExtensionControlFile | ExtensionControlFile |
typedef struct ExtensionVersionInfo | ExtensionVersionInfo |
Functions | |
static List * | find_update_path (List *evi_list, ExtensionVersionInfo *evi_start, ExtensionVersionInfo *evi_target, bool reject_indirect, bool reinitialize) |
static Oid | get_required_extension (char *reqExtensionName, char *extensionName, char *origSchemaName, bool cascade, List *parents, bool is_create) |
static void | get_available_versions_for_extension (ExtensionControlFile *pcontrol, Tuplestorestate *tupstore, TupleDesc tupdesc) |
static Datum | convert_requires_to_datum (List *requires) |
static void | ApplyExtensionUpdates (Oid extensionOid, ExtensionControlFile *pcontrol, const char *initialVersion, List *updateVersions, char *origSchemaName, bool cascade, bool is_create) |
static void | ExecAlterExtensionContentsRecurse (AlterExtensionContentsStmt *stmt, ObjectAddress extension, ObjectAddress object) |
static char * | read_whole_file (const char *filename, int *length) |
Oid | get_extension_oid (const char *extname, bool missing_ok) |
char * | get_extension_name (Oid ext_oid) |
Oid | get_extension_schema (Oid ext_oid) |
static void | check_valid_extension_name (const char *extensionname) |
static void | check_valid_version_name (const char *versionname) |
static bool | is_extension_control_filename (const char *filename) |
static bool | is_extension_script_filename (const char *filename) |
static char * | get_extension_control_directory (void) |
static char * | get_extension_control_filename (const char *extname) |
static char * | get_extension_script_directory (ExtensionControlFile *control) |
static char * | get_extension_aux_control_filename (ExtensionControlFile *control, const char *version) |
static char * | get_extension_script_filename (ExtensionControlFile *control, const char *from_version, const char *version) |
static void | parse_extension_control_file (ExtensionControlFile *control, const char *version) |
static ExtensionControlFile * | read_extension_control_file (const char *extname) |
static ExtensionControlFile * | read_extension_aux_control_file (const ExtensionControlFile *pcontrol, const char *version) |
static char * | read_extension_script_file (const ExtensionControlFile *control, const char *filename) |
static void | script_error_callback (void *arg) |
static void | execute_sql_string (const char *sql, const char *filename) |
static bool | extension_is_trusted (ExtensionControlFile *control) |
static void | execute_extension_script (Oid extensionOid, ExtensionControlFile *control, const char *from_version, const char *version, List *requiredSchemas, const char *schemaName, Oid schemaOid) |
static ExtensionVersionInfo * | get_ext_ver_info (const char *versionname, List **evi_list) |
static ExtensionVersionInfo * | get_nearest_unprocessed_vertex (List *evi_list) |
static List * | get_ext_ver_list (ExtensionControlFile *control) |
static List * | identify_update_path (ExtensionControlFile *control, const char *oldVersion, const char *newVersion) |
static ExtensionVersionInfo * | find_install_path (List *evi_list, ExtensionVersionInfo *evi_target, List **best_path) |
static ObjectAddress | CreateExtensionInternal (char *extensionName, char *schemaName, const char *versionName, bool cascade, List *parents, bool is_create) |
ObjectAddress | CreateExtension (ParseState *pstate, CreateExtensionStmt *stmt) |
ObjectAddress | InsertExtensionTuple (const char *extName, Oid extOwner, Oid schemaOid, bool relocatable, const char *extVersion, Datum extConfig, Datum extCondition, List *requiredExtensions) |
void | RemoveExtensionById (Oid extId) |
Datum | pg_available_extensions (PG_FUNCTION_ARGS) |
Datum | pg_available_extension_versions (PG_FUNCTION_ARGS) |
bool | extension_file_exists (const char *extensionName) |
Datum | pg_extension_update_paths (PG_FUNCTION_ARGS) |
Datum | pg_extension_config_dump (PG_FUNCTION_ARGS) |
static void | extension_config_remove (Oid extensionoid, Oid tableoid) |
ObjectAddress | AlterExtensionNamespace (const char *extensionName, const char *newschema, Oid *oldschema) |
ObjectAddress | ExecAlterExtensionStmt (ParseState *pstate, AlterExtensionStmt *stmt) |
ObjectAddress | ExecAlterExtensionContentsStmt (AlterExtensionContentsStmt *stmt, ObjectAddress *objAddr) |
Variables | |
bool | creating_extension = false |
Oid | CurrentExtensionObject = InvalidOid |
typedef struct ExtensionControlFile ExtensionControlFile |
typedef struct ExtensionVersionInfo ExtensionVersionInfo |
ObjectAddress AlterExtensionNamespace | ( | const char * | extensionName, |
const char * | newschema, | ||
Oid * | oldschema | ||
) |
Definition at line 2883 of file extension.c.
References AccessShareLock, ACL_CREATE, aclcheck_error(), ACLCHECK_NOT_OWNER, ACLCHECK_OK, AlterObjectNamespace_oid(), BTEqualStrategyNumber, CatalogTupleUpdate(), changeDependencyFor(), ObjectAddress::classId, DEPENDENCY_EXTENSION, DEPENDENCY_NORMAL, elog, ereport, errcode(), errdetail(), errmsg(), ERROR, get_extension_name(), get_extension_oid(), get_namespace_name(), getExtensionOfObject(), getObjectDescription(), GETSTRUCT, GetUserId(), heap_copytuple(), HeapTupleIsValid, InvalidObjectAddress, InvalidOid, InvokeObjectPostAlterHook, sort-test::key, lfirst, LookupCreationNamespace(), NameStr, new_object_addresses(), ExtensionControlFile::no_relocate, object_aclcheck(), OBJECT_EXTENSION, object_ownercheck(), OBJECT_SCHEMA, ObjectAddressSet, ObjectAddress::objectId, ObjectIdGetDatum(), ObjectAddress::objectSubId, read_extension_control_file(), relation_close(), RowExclusiveLock, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), HeapTupleData::t_self, table_close(), and table_open().
Referenced by ExecAlterObjectSchemaStmt().
|
static |
Definition at line 3245 of file extension.c.
References BoolGetDatum(), BTEqualStrategyNumber, CatalogTupleUpdate(), ObjectAddress::classId, CStringGetTextDatum, deleteDependencyRecordsForClass(), DEPENDENCY_NORMAL, elog, ERROR, execute_extension_script(), get_extension_schema(), get_namespace_name(), get_required_extension(), GETSTRUCT, heap_modify_tuple(), HeapTupleIsValid, InvokeObjectPostAlterHook, sort-test::key, lappend_oid(), lfirst, lfirst_oid, ExtensionControlFile::name, NIL, ObjectAddress::objectId, ObjectIdGetDatum(), ObjectAddress::objectSubId, read_extension_aux_control_file(), recordDependencyOn(), RelationGetDescr, ExtensionControlFile::relocatable, ExtensionControlFile::requires, RowExclusiveLock, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), HeapTupleData::t_self, table_close(), table_open(), and values.
Referenced by CreateExtensionInternal(), and ExecAlterExtensionStmt().
|
static |
Definition at line 222 of file extension.c.
References ereport, errcode(), errdetail(), errmsg(), ERROR, and first_dir_separator().
Referenced by CreateExtension(), get_required_extension(), and pg_extension_update_paths().
|
static |
Definition at line 269 of file extension.c.
References ereport, errcode(), errdetail(), errmsg(), ERROR, and first_dir_separator().
Referenced by CreateExtensionInternal(), and ExecAlterExtensionStmt().
Definition at line 2424 of file extension.c.
References a, construct_array_builtin(), CStringGetDatum(), DirectFunctionCall1, lfirst, list_length(), namein(), palloc(), and PointerGetDatum().
Referenced by get_available_versions_for_extension().
ObjectAddress CreateExtension | ( | ParseState * | pstate, |
CreateExtensionStmt * | stmt | ||
) |
Definition at line 1879 of file extension.c.
References check_valid_extension_name(), CreateExtensionInternal(), creating_extension, defGetBoolean(), defGetString(), DefElem::defname, elog, ereport, errcode(), ERRCODE_DUPLICATE_OBJECT, errmsg(), ERROR, errorConflictingDefElem(), get_extension_oid(), InvalidObjectAddress, InvalidOid, lfirst, NIL, NOTICE, and stmt.
Referenced by ProcessUtilitySlow().
|
static |
Definition at line 1569 of file extension.c.
References ApplyExtensionUpdates(), CreateSchemaStmt::authrole, check_valid_version_name(), ExtensionControlFile::comment, CreateComments(), CreateSchemaCommand(), ExtensionControlFile::default_version, ereport, errcode(), errmsg(), ERROR, execute_extension_script(), fetch_search_path(), filename, find_install_path(), get_ext_ver_info(), get_ext_ver_list(), get_extension_schema(), get_extension_script_filename(), get_namespace_name(), get_namespace_oid(), get_required_extension(), GetUserId(), CreateSchemaStmt::if_not_exists, InsertExtensionTuple(), InvalidOid, isTempNamespace(), lappend_oid(), lfirst, linitial_oid, list_free(), makeNode, MyXactFlags, ExtensionControlFile::name, ExtensionVersionInfo::name, NIL, ObjectAddress::objectId, OidIsValid, PointerGetDatum(), read_extension_aux_control_file(), read_extension_control_file(), ExtensionControlFile::relocatable, ExtensionControlFile::requires, ExtensionControlFile::schema, CreateSchemaStmt::schemaElts, CreateSchemaStmt::schemaname, stat, and XACT_FLAGS_ACCESSEDTEMPNAMESPACE.
Referenced by CreateExtension(), and get_required_extension().
|
static |
Definition at line 3489 of file extension.c.
References ObjectAddress::classId, deleteDependencyRecordsForClass(), DEPENDENCY_EXTENSION, elog, ereport, errcode(), errmsg(), ERROR, extension_config_remove(), format_type_be(), get_array_type(), get_extension_name(), get_extension_schema(), get_namespace_name(), get_range_multirange(), get_rel_type_id(), getExtensionOfObject(), getObjectDescription(), ObjectAddress::objectId, ObjectAddress::objectSubId, OidIsValid, recordDependencyOn(), recordExtObjInitPriv(), removeExtObjInitPriv(), stmt, and type_is_range().
Referenced by ExecAlterExtensionContentsStmt().
ObjectAddress ExecAlterExtensionContentsStmt | ( | AlterExtensionContentsStmt * | stmt, |
ObjectAddress * | objAddr | ||
) |
Definition at line 3403 of file extension.c.
References AccessShareLock, aclcheck_error(), ACLCHECK_NOT_OWNER, Assert, check_object_ownership(), ereport, errcode(), errmsg(), ERROR, ExecAlterExtensionContentsRecurse(), get_object_address(), GetUserId(), InvokeObjectPostAlterHook, makeString(), NoLock, OBJECT_DATABASE, OBJECT_EXTENSION, OBJECT_INDEX, object_ownercheck(), OBJECT_PUBLICATION, OBJECT_ROLE, OBJECT_STATISTIC_EXT, OBJECT_SUBSCRIPTION, OBJECT_TABLESPACE, ObjectAddress::objectId, relation_close(), ShareUpdateExclusiveLock, and stmt.
Referenced by ProcessUtilitySlow().
ObjectAddress ExecAlterExtensionStmt | ( | ParseState * | pstate, |
AlterExtensionStmt * | stmt | ||
) |
Definition at line 3098 of file extension.c.
References AccessShareLock, aclcheck_error(), ACLCHECK_NOT_OWNER, ApplyExtensionUpdates(), DefElem::arg, BTEqualStrategyNumber, check_valid_version_name(), creating_extension, CStringGetDatum(), DatumGetTextPP, ExtensionControlFile::default_version, DefElem::defname, elog, ereport, errcode(), errmsg(), ERROR, errorConflictingDefElem(), GETSTRUCT, GetUserId(), heap_getattr(), HeapTupleIsValid, identify_update_path(), InvalidObjectAddress, sort-test::key, lfirst, NOTICE, OBJECT_EXTENSION, object_ownercheck(), ObjectAddressSet, read_extension_control_file(), RelationGetDescr, ScanKeyInit(), stmt, strVal, systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), table_open(), and text_to_cstring().
Referenced by ProcessUtilitySlow().
|
static |
Definition at line 981 of file extension.c.
References appendStringInfo(), appendStringInfoString(), Assert, AtEOXact_GUC(), check_function_bodies, client_min_messages, creating_extension, CStringGetTextDatum, CurrentExtensionObject, StringInfoData::data, DatumGetTextPP, DEBUG1, DirectFunctionCall3Coll(), DirectFunctionCall4Coll(), elog, ereport, errcode(), errhint(), errmsg(), ERROR, execute_sql_string(), extension_is_trusted(), filename, forboth, get_extension_script_filename(), get_namespace_name(), GetUserId(), GetUserIdAndSecContext(), GetUserNameFromId(), GUC_ACTION_SAVE, initStringInfo(), InvalidOid, lfirst, lfirst_oid, list_length(), log_min_messages, ExtensionControlFile::module_pathname, ExtensionControlFile::name, NewGUCNestLevel(), PG_END_TRY, PG_FINALLY, PG_TRY, PGC_S_SESSION, PGC_SUSET, PGC_USERSET, psprintf(), quote_identifier(), read_extension_script_file(), ExtensionControlFile::relocatable, replace_text(), ExtensionControlFile::requires, SECURITY_LOCAL_USERID_CHANGE, set_config_option(), set_config_option_ext(), SetUserIdAndSecContext(), ExtensionControlFile::superuser, superuser(), text_to_cstring(), textregexreplace(), ExtensionControlFile::trusted, and WARNING.
Referenced by ApplyExtensionUpdates(), and CreateExtensionInternal().
|
static |
Definition at line 831 of file extension.c.
References ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, ErrorContextCallback::arg, ErrorContextCallback::callback, CommandCounterIncrement(), CreateDestReceiver(), CreateQueryDesc(), CurrentMemoryContext, CURSOR_OPT_PARALLEL_OK, generate_unaccent_rules::dest, DestNone, ereport, errcode(), errmsg(), ERROR, error_context_stack, ExecutorEnd(), ExecutorFinish(), ExecutorRun(), ExecutorStart(), script_error_callback_arg::filename, filename, ForwardScanDirection, FreeQueryDesc(), GetActiveSnapshot(), GetTransactionSnapshot(), IsA, lfirst_node, MemoryContextDelete(), MemoryContextSwitchTo(), pg_analyze_and_rewrite_fixedparams(), pg_parse_query(), pg_plan_queries(), PopActiveSnapshot(), ErrorContextCallback::previous, PROCESS_UTILITY_QUERY, ProcessUtility(), PushActiveSnapshot(), script_error_callback(), script_error_callback_arg::sql, stmt, script_error_callback_arg::stmt_len, RawStmt::stmt_len, script_error_callback_arg::stmt_location, and RawStmt::stmt_location.
Referenced by execute_extension_script().
Definition at line 2718 of file extension.c.
References a, ARR_DATA_PTR, ARR_DIMS, ARR_ELEMTYPE, ARR_HASNULL, ARR_LBOUND, ARR_NDIM, BTEqualStrategyNumber, CatalogTupleUpdate(), construct_array_builtin(), DatumGetArrayTypeP, deconstruct_array_builtin(), elog, ERROR, heap_getattr(), heap_modify_tuple(), HeapTupleIsValid, i, sort-test::key, ObjectIdGetDatum(), PointerGetDatum(), RelationGetDescr, RowExclusiveLock, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), HeapTupleData::t_self, table_close(), and table_open().
Referenced by ExecAlterExtensionContentsRecurse().
bool extension_file_exists | ( | const char * | extensionName | ) |
Definition at line 2371 of file extension.c.
References AllocateDir(), dirent::d_name, FreeDir(), get_extension_control_directory(), is_extension_control_filename(), pstrdup(), and ReadDir().
Referenced by CreateFunction(), and ExecuteDoStmt().
|
static |
Definition at line 959 of file extension.c.
References ACL_CREATE, ACLCHECK_OK, GetUserId(), MyDatabaseId, object_aclcheck(), and ExtensionControlFile::trusted.
Referenced by execute_extension_script().
|
static |
Definition at line 1514 of file extension.c.
References find_update_path(), ExtensionVersionInfo::installable, lfirst, list_length(), ExtensionVersionInfo::name, and NIL.
Referenced by CreateExtensionInternal(), and get_available_versions_for_extension().
|
static |
Definition at line 1421 of file extension.c.
References Assert, ExtensionVersionInfo::distance, ExtensionVersionInfo::distance_known, get_nearest_unprocessed_vertex(), ExtensionVersionInfo::installable, lcons(), lfirst, ExtensionVersionInfo::name, NIL, ExtensionVersionInfo::previous, and ExtensionVersionInfo::reachable.
Referenced by find_install_path(), identify_update_path(), and pg_extension_update_paths().
|
static |
Definition at line 2257 of file extension.c.
References BoolGetDatum(), ExtensionControlFile::comment, convert_requires_to_datum(), CStringGetDatum(), CStringGetTextDatum, DirectFunctionCall1, find_install_path(), get_ext_ver_list(), ExtensionVersionInfo::installable, lfirst, ExtensionControlFile::name, ExtensionVersionInfo::name, namein(), NIL, read_extension_aux_control_file(), ExtensionControlFile::relocatable, ExtensionControlFile::requires, ExtensionControlFile::schema, ExtensionControlFile::superuser, ExtensionControlFile::trusted, tuplestore_putvalues(), and values.
Referenced by pg_available_extension_versions().
|
static |
Definition at line 1254 of file extension.c.
References ExtensionVersionInfo::distance, ExtensionVersionInfo::distance_known, ExtensionVersionInfo::installable, lappend(), lfirst, ExtensionVersionInfo::name, NIL, palloc(), ExtensionVersionInfo::previous, pstrdup(), and ExtensionVersionInfo::reachable.
Referenced by CreateExtensionInternal(), get_ext_ver_list(), and identify_update_path().
|
static |
Definition at line 1315 of file extension.c.
References AllocateDir(), dirent::d_name, FreeDir(), get_ext_ver_info(), get_extension_script_directory(), ExtensionVersionInfo::installable, is_extension_script_filename(), lappend(), ExtensionControlFile::name, NIL, pstrdup(), ExtensionVersionInfo::reachable, and ReadDir().
Referenced by CreateExtensionInternal(), get_available_versions_for_extension(), identify_update_path(), and pg_extension_update_paths().
|
static |
Definition at line 382 of file extension.c.
References get_extension_script_directory(), MAXPGPATH, ExtensionControlFile::name, palloc(), pfree(), and snprintf.
Referenced by parse_extension_control_file().
|
static |
Definition at line 332 of file extension.c.
References get_share_path(), MAXPGPATH, my_exec_path, palloc(), and snprintf.
Referenced by extension_file_exists(), get_extension_script_directory(), pg_available_extension_versions(), and pg_available_extensions().
|
static |
Definition at line 345 of file extension.c.
References get_share_path(), MAXPGPATH, my_exec_path, palloc(), and snprintf.
Referenced by parse_extension_control_file().
char* get_extension_name | ( | Oid | ext_oid | ) |
Definition at line 180 of file extension.c.
References GETSTRUCT, HeapTupleIsValid, NameStr, ObjectIdGetDatum(), pstrdup(), ReleaseSysCache(), and SearchSysCache1().
Referenced by AlterExtensionNamespace(), checkMembershipInCurrentExtension(), ExecAlterExtensionContentsRecurse(), getObjectDescription(), getObjectIdentityParts(), recordDependencyOnCurrentExtension(), and RemoveExtensionById().
Oid get_extension_oid | ( | const char * | extname, |
bool | missing_ok | ||
) |
Definition at line 158 of file extension.c.
References CStringGetDatum(), ereport, errcode(), errmsg(), ERROR, GetSysCacheOid1, and OidIsValid.
Referenced by AlterExtensionNamespace(), binary_upgrade_create_empty_extension(), CreateExtension(), ExtractExtensionList(), get_object_address_unqualified(), and get_required_extension().
Definition at line 202 of file extension.c.
References GETSTRUCT, HeapTupleIsValid, InvalidOid, ObjectIdGetDatum(), ReleaseSysCache(), and SearchSysCache1().
Referenced by ApplyExtensionUpdates(), CreateExtensionInternal(), and ExecAlterExtensionContentsRecurse().
|
static |
Definition at line 359 of file extension.c.
References ExtensionControlFile::directory, get_extension_control_directory(), get_share_path(), is_absolute_path, MAXPGPATH, my_exec_path, palloc(), pstrdup(), and snprintf.
Referenced by get_ext_ver_list(), get_extension_aux_control_filename(), and get_extension_script_filename().
|
static |
Definition at line 400 of file extension.c.
References get_extension_script_directory(), MAXPGPATH, ExtensionControlFile::name, palloc(), pfree(), and snprintf.
Referenced by CreateExtensionInternal(), and execute_extension_script().
|
static |
Definition at line 1287 of file extension.c.
References ExtensionVersionInfo::distance, ExtensionVersionInfo::distance_known, and lfirst.
Referenced by find_update_path().
|
static |
Definition at line 1808 of file extension.c.
References check_valid_extension_name(), CreateExtensionInternal(), ereport, errcode(), errhint(), errmsg(), ERROR, get_extension_oid(), lappend(), lfirst, list_copy(), NOTICE, ObjectAddress::objectId, and OidIsValid.
Referenced by ApplyExtensionUpdates(), and CreateExtensionInternal().
|
static |
Definition at line 1378 of file extension.c.
References ereport, errcode(), errmsg(), ERROR, find_update_path(), get_ext_ver_info(), get_ext_ver_list(), ExtensionControlFile::name, and NIL.
Referenced by ExecAlterExtensionStmt().
ObjectAddress InsertExtensionTuple | ( | const char * | extName, |
Oid | extOwner, | ||
Oid | schemaOid, | ||
bool | relocatable, | ||
const char * | extVersion, | ||
Datum | extConfig, | ||
Datum | extCondition, | ||
List * | requiredExtensions | ||
) |
Definition at line 1977 of file extension.c.
References add_exact_object_address(), BoolGetDatum(), CatalogTupleInsert(), CStringGetDatum(), CStringGetTextDatum, DEPENDENCY_NORMAL, DirectFunctionCall1, free_object_addresses(), GetNewOidWithIndex(), heap_form_tuple(), heap_freetuple(), InvokeObjectPostCreateHook, lfirst_oid, namein(), new_object_addresses(), ObjectAddressSet, ObjectIdGetDatum(), PointerGetDatum(), RelationData::rd_att, record_object_address_dependencies(), recordDependencyOnOwner(), RowExclusiveLock, table_close(), table_open(), and values.
Referenced by binary_upgrade_create_empty_extension(), and CreateExtensionInternal().
|
static |
Definition at line 316 of file extension.c.
References filename.
Referenced by extension_file_exists(), pg_available_extension_versions(), and pg_available_extensions().
|
static |
|
static |
Definition at line 432 of file extension.c.
References AllocateFile(), ExtensionControlFile::comment, CONF_FILE_START_DEPTH, ExtensionControlFile::default_version, ExtensionControlFile::directory, ExtensionControlFile::encoding, ereport, errcode(), errcode_for_file_access(), errdetail(), errhint(), errmsg(), ERROR, filename, FreeConfigVariables(), FreeFile(), get_extension_aux_control_filename(), get_extension_control_filename(), ExtensionControlFile::module_pathname, ExtensionControlFile::name, ConfigVariable::name, ConfigVariable::next, ExtensionControlFile::no_relocate, parse_bool(), ParseConfigFp(), pfree(), pg_valid_server_encoding, pstrdup(), ExtensionControlFile::relocatable, ExtensionControlFile::requires, ExtensionControlFile::schema, SplitIdentifierString(), ExtensionControlFile::superuser, ExtensionControlFile::trusted, and ConfigVariable::value.
Referenced by read_extension_aux_control_file(), and read_extension_control_file().
Datum pg_available_extension_versions | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2199 of file extension.c.
References AllocateDir(), FreeDir(), get_available_versions_for_extension(), get_extension_control_directory(), InitMaterializedSRF(), is_extension_control_filename(), pstrdup(), read_extension_control_file(), ReadDir(), ReturnSetInfo::setDesc, and ReturnSetInfo::setResult.
Datum pg_available_extensions | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2119 of file extension.c.
References AllocateDir(), ExtensionControlFile::comment, CStringGetDatum(), CStringGetTextDatum, ExtensionControlFile::default_version, DirectFunctionCall1, FreeDir(), get_extension_control_directory(), InitMaterializedSRF(), is_extension_control_filename(), ExtensionControlFile::name, namein(), pstrdup(), read_extension_control_file(), ReadDir(), ReturnSetInfo::setDesc, ReturnSetInfo::setResult, tuplestore_putvalues(), and values.
Datum pg_extension_config_dump | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2535 of file extension.c.
References a, ARR_DATA_PTR, ARR_DIMS, ARR_ELEMTYPE, ARR_HASNULL, ARR_LBOUND, ARR_NDIM, array_set(), BTEqualStrategyNumber, CatalogTupleUpdate(), construct_array_builtin(), creating_extension, CurrentExtensionObject, DatumGetArrayTypeP, elog, ereport, errcode(), ERRCODE_UNDEFINED_TABLE, errmsg(), ERROR, get_rel_name(), getExtensionOfObject(), heap_getattr(), heap_modify_tuple(), HeapTupleIsValid, i, sort-test::key, ObjectIdGetDatum(), PG_GETARG_OID, PG_GETARG_TEXT_PP, PG_RETURN_VOID, PointerGetDatum(), RelationGetDescr, RowExclusiveLock, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), HeapTupleData::t_self, table_close(), and table_open().
Datum pg_extension_update_paths | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2450 of file extension.c.
References appendStringInfoString(), check_valid_extension_name(), CStringGetTextDatum, StringInfoData::data, find_update_path(), get_ext_ver_list(), InitMaterializedSRF(), initStringInfo(), lfirst, ExtensionVersionInfo::name, NameStr, NIL, pfree(), PG_GETARG_NAME, read_extension_control_file(), ReturnSetInfo::setDesc, ReturnSetInfo::setResult, tuplestore_putvalues(), and values.
|
static |
Definition at line 633 of file extension.c.
References palloc(), and parse_extension_control_file().
Referenced by ApplyExtensionUpdates(), CreateExtensionInternal(), and get_available_versions_for_extension().
|
static |
Definition at line 604 of file extension.c.
References ExtensionControlFile::encoding, ExtensionControlFile::name, palloc0(), parse_extension_control_file(), pstrdup(), ExtensionControlFile::relocatable, ExtensionControlFile::superuser, and ExtensionControlFile::trusted.
Referenced by AlterExtensionNamespace(), CreateExtensionInternal(), ExecAlterExtensionStmt(), pg_available_extension_versions(), pg_available_extensions(), and pg_extension_update_paths().
|
static |
Definition at line 656 of file extension.c.
References ExtensionControlFile::encoding, filename, GetDatabaseEncoding(), len, pg_any_to_server(), pg_verify_mbstr(), and read_whole_file().
Referenced by execute_extension_script().
|
static |
Definition at line 3629 of file extension.c.
References AllocateFile(), buf, ereport, errcode(), errcode_for_file_access(), errmsg(), ERROR, filename, FreeFile(), if(), MaxAllocSize, palloc(), PG_BINARY_R, stat::st_size, and stat.
Referenced by read_extension_script_file().
void RemoveExtensionById | ( | Oid | extId | ) |
Definition at line 2065 of file extension.c.
References BTEqualStrategyNumber, CatalogTupleDelete(), CurrentExtensionObject, ereport, errcode(), errmsg(), ERROR, get_extension_name(), HeapTupleIsValid, ObjectIdGetDatum(), RowExclusiveLock, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), HeapTupleData::t_self, table_close(), and table_open().
Referenced by doDeletion().
|
static |
Definition at line 689 of file extension.c.
References arg, CleanQuerytext(), errcontext, errposition(), script_error_callback_arg::filename, geterrposition(), internalerrposition(), internalerrquery(), len, pnstrdup(), script_error_callback_arg::sql, script_error_callback_arg::stmt_len, and script_error_callback_arg::stmt_location.
Referenced by execute_sql_string().
bool creating_extension = false |
Definition at line 73 of file extension.c.
Referenced by checkMembershipInCurrentExtension(), CreateExtension(), EventTriggerAlterTableStart(), EventTriggerCollectAlterDefPrivs(), EventTriggerCollectAlterOpFam(), EventTriggerCollectAlterTSConfig(), EventTriggerCollectCreateOpClass(), EventTriggerCollectGrant(), EventTriggerCollectSimpleCommand(), ExecAlterExtensionStmt(), execute_extension_script(), findDependentObjects(), pg_extension_config_dump(), recordDependencyOnCurrentExtension(), and recordExtensionInitPriv().
Oid CurrentExtensionObject = InvalidOid |
Definition at line 74 of file extension.c.
Referenced by checkMembershipInCurrentExtension(), execute_extension_script(), findDependentObjects(), pg_extension_config_dump(), recordDependencyOnCurrentExtension(), and RemoveExtensionById().