PostgreSQL Source Code
git master
|
#include "postgres_fe.h"
#include <ctype.h>
#include "catalog/pg_class_d.h"
#include "catalog/pg_collation_d.h"
#include "catalog/pg_extension_d.h"
#include "catalog/pg_namespace_d.h"
#include "catalog/pg_operator_d.h"
#include "catalog/pg_proc_d.h"
#include "catalog/pg_publication_d.h"
#include "catalog/pg_subscription_d.h"
#include "catalog/pg_type_d.h"
#include "common/hashfn.h"
#include "pg_backup_utils.h"
#include "pg_dump.h"
#include "lib/simplehash.h"
Go to the source code of this file.
Data Structures | |
struct | _catalogIdMapEntry |
Macros | |
#define | SH_PREFIX catalogid |
#define | SH_ELEMENT_TYPE CatalogIdMapEntry |
#define | SH_KEY_TYPE CatalogId |
#define | SH_KEY catId |
#define | SH_HASH_KEY(tb, key) hash_bytes((const unsigned char *) &(key), sizeof(CatalogId)) |
#define | SH_EQUAL(tb, a, b) ((a).oid == (b).oid && (a).tableoid == (b).tableoid) |
#define | SH_STORE_HASH |
#define | SH_GET_HASH(tb, a) (a)->hashval |
#define | SH_SCOPE static inline |
#define | SH_RAW_ALLOCATOR pg_malloc0 |
#define | SH_DECLARE |
#define | SH_DEFINE |
#define | CATALOGIDHASH_INITIAL_SIZE 10000 |
Typedefs | |
typedef struct _catalogIdMapEntry | CatalogIdMapEntry |
Variables | |
static DumpableObject ** | dumpIdMap = NULL |
static int | allocedDumpIds = 0 |
static DumpId | lastDumpId = 0 |
static catalogid_hash * | catalogIdHash = NULL |
#define SH_ELEMENT_TYPE CatalogIdMapEntry |
#define SH_HASH_KEY | ( | tb, | |
key | |||
) | hash_bytes((const unsigned char *) &(key), sizeof(CatalogId)) |
#define SH_RAW_ALLOCATOR pg_malloc0 |
typedef struct _catalogIdMapEntry CatalogIdMapEntry |
void addObjectDependency | ( | DumpableObject * | dobj, |
DumpId | refId | ||
) |
Definition at line 795 of file common.c.
References _dumpableObject::allocDeps, _dumpableObject::dependencies, _dumpableObject::nDeps, pg_malloc_array, and pg_realloc_array.
Referenced by addBoundaryDependencies(), addConstrChildIdxDeps(), buildMatViewRefreshDependencies(), checkExtensionMembership(), flagInhAttrs(), flagInhIndexes(), flagInhTables(), getDependencies(), getDomainConstraints(), getRules(), getTableAttrs(), getTableDataFKConstraints(), makeTableDataInfo(), processExtensionTables(), repairDomainConstraintMultiLoop(), repairTableAttrDefMultiLoop(), repairTableConstraintMultiLoop(), repairTypeFuncLoop(), and repairViewRuleMultiLoop().
void AssignDumpId | ( | DumpableObject * | dobj | ) |
Definition at line 634 of file common.c.
References _dumpableObject::allocDeps, allocedDumpIds, Assert, catalogIdHash, CATALOGIDHASH_INITIAL_SIZE, _dumpableObject::catId, _dumpableObject::components, _dumpableObject::dependencies, _dumpableObject::depends_on_ext, _catalogIdMapEntry::dobj, _dumpableObject::dump, DUMP_COMPONENT_ALL, DUMP_COMPONENT_DEFINITION, _dumpableObject::dump_contains, _dumpableObject::dumpId, dumpIdMap, _catalogIdMapEntry::ext, _dumpableObject::ext_member, lastDumpId, _dumpableObject::name, _dumpableObject::nDeps, OidIsValid, pg_malloc_array, pg_realloc_array, and CatalogId::tableoid.
Referenced by createBoundaryObjects(), flagInhAttrs(), flagInhIndexes(), flagInhTables(), getAccessMethods(), getAggregates(), getCasts(), getCollations(), getConstraints(), getConversions(), getDefaultACLs(), getDomainConstraints(), getEventTriggers(), getExtendedStatistics(), getExtensions(), getForeignDataWrappers(), getForeignServers(), getFuncs(), getIndexes(), getLOs(), getNamespaces(), getOpclasses(), getOperators(), getOpfamilies(), getPolicies(), getProcLangs(), getPublicationNamespaces(), getPublications(), getPublicationTables(), getRules(), getSubscriptions(), getSubscriptionTables(), getTableAttrs(), getTables(), getTransforms(), getTriggers(), getTSConfigurations(), getTSDictionaries(), getTSParsers(), getTSTemplates(), getTypes(), and makeTableDataInfo().
DumpId createDumpId | ( | void | ) |
Definition at line 722 of file common.c.
References lastDumpId.
Referenced by dumpACL(), dumpCommentExtended(), dumpCompositeTypeColComments(), dumpDatabase(), dumpEncoding(), dumpSearchPath(), dumpSecLabel(), dumpSequence(), dumpSequenceData(), dumpStdStrings(), dumpTableComment(), dumpTableSecLabel(), and dumpUserMappings().
Definition at line 931 of file common.c.
References Assert, DO_COLLATION, findObjectByCatalogId(), _dumpableObject::objType, CatalogId::oid, and CatalogId::tableoid.
Referenced by createDummyViewAsClause(), dumpCompositeType(), dumpDomain(), dumpRangeType(), and dumpTableSchema().
ExtensionInfo* findExtensionByOid | ( | Oid | oid | ) |
Definition at line 967 of file common.c.
References Assert, DO_EXTENSION, findObjectByCatalogId(), _dumpableObject::objType, CatalogId::oid, and CatalogId::tableoid.
Referenced by getExtensionMembership().
Definition at line 895 of file common.c.
References Assert, DO_FUNC, findObjectByCatalogId(), _dumpableObject::objType, CatalogId::oid, and CatalogId::tableoid.
Referenced by dumpCast(), dumpProcLang(), and dumpTransform().
Definition at line 858 of file common.c.
References Assert, DO_INDEX, findObjectByCatalogId(), _dumpableObject::objType, CatalogId::oid, and CatalogId::tableoid.
Referenced by flagInhIndexes().
NamespaceInfo* findNamespaceByOid | ( | Oid | oid | ) |
Definition at line 949 of file common.c.
References Assert, DO_NAMESPACE, findObjectByCatalogId(), _dumpableObject::objType, CatalogId::oid, and CatalogId::tableoid.
Referenced by findNamespace(), and getPublicationNamespaces().
DumpableObject* findObjectByCatalogId | ( | CatalogId | catalogId | ) |
Definition at line 755 of file common.c.
References catalogIdHash, and _catalogIdMapEntry::dobj.
Referenced by buildMatViewRefreshDependencies(), collectComments(), collectSecLabels(), findCollationByOid(), findExtensionByOid(), findFuncByOid(), findIndexByOid(), findNamespaceByOid(), findOprByOid(), findPublicationByOid(), findSubscriptionByOid(), findTableByOid(), findTypeByOid(), getAdditionalACLs(), and getDependencies().
DumpableObject* findObjectByDumpId | ( | DumpId | dumpId | ) |
Definition at line 742 of file common.c.
References allocedDumpIds, and dumpIdMap.
Referenced by binary_upgrade_extension_member(), BuildArchiveDependencies(), dumpConstraint(), dumpDumpableObject(), dumpExtension(), findDumpableDependencies(), and findLoop().
Definition at line 913 of file common.c.
References Assert, DO_OPERATOR, findObjectByCatalogId(), _dumpableObject::objType, CatalogId::oid, and CatalogId::tableoid.
Referenced by getFormattedOperatorName().
ExtensionInfo* findOwningExtension | ( | CatalogId | catalogId | ) |
Definition at line 1046 of file common.c.
References catalogIdHash, and _catalogIdMapEntry::ext.
Referenced by checkExtensionMembership().
PublicationInfo* findPublicationByOid | ( | Oid | oid | ) |
Definition at line 985 of file common.c.
References Assert, DO_PUBLICATION, findObjectByCatalogId(), _dumpableObject::objType, CatalogId::oid, and CatalogId::tableoid.
Referenced by getPublicationNamespaces(), and getPublicationTables().
SubscriptionInfo* findSubscriptionByOid | ( | Oid | oid | ) |
Definition at line 1003 of file common.c.
References Assert, DO_SUBSCRIPTION, findObjectByCatalogId(), _dumpableObject::objType, CatalogId::oid, and CatalogId::tableoid.
Referenced by getSubscriptionTables().
Definition at line 840 of file common.c.
References Assert, DO_TABLE, findObjectByCatalogId(), _dumpableObject::objType, CatalogId::oid, and CatalogId::tableoid.
Referenced by dumpSequence(), flagInhTables(), getAdditionalACLs(), getConstraints(), getExtendedStatistics(), getOwnedSeqs(), getPartitioningInfo(), getPolicies(), getPublicationTables(), getRules(), getSubscriptionTables(), getTableDataFKConstraints(), processExtensionTables(), and selectDumpableType().
Definition at line 876 of file common.c.
References Assert, DO_DUMMY_TYPE, DO_TYPE, findObjectByCatalogId(), _dumpableObject::objType, CatalogId::oid, and CatalogId::tableoid.
Referenced by binary_upgrade_set_type_oids_by_type_oid(), collectComments(), collectSecLabels(), DOTypeNameCompare(), getCasts(), getFormattedTypeName(), and getTransforms().
|
static |
Definition at line 477 of file common.c.
References addObjectDependency(), _attrDefInfo::adef_expr, _attrDefInfo::adnum, _attrDefInfo::adtable, AssignDumpId(), _tableInfo::attgenerated, _tableInfo::attisdropped, _tableInfo::attnames, _tableInfo::attrdefs, _dumpOptions::binary_upgrade, _dumpableObject::catId, DO_ATTRDEF, _tableInfo::dobj, _attrDefInfo::dobj, _dumpableObject::dump, DUMP_COMPONENT_NONE, _dumpableObject::dumpId, i, _tableInfo::ispartition, j, _dumpableObject::name, _tableInfo::notnull_constrs, _tableInfo::notnull_islocal, _tableInfo::numatts, _tableInfo::numParents, _dumpableObject::objType, CatalogId::oid, _tableInfo::parents, pg_malloc_object, pg_strdup(), _tableInfo::relkind, Archive::remoteVersion, _attrDefInfo::separate, shouldPrintColumn(), strInArray(), and CatalogId::tableoid.
Referenced by getSchemaData().
Referenced by getSchemaData().
Definition at line 386 of file common.c.
References addObjectDependency(), Assert, AssignDumpId(), _dumpableObject::catId, DO_INDEX_ATTACH, _tableInfo::dobj, _indxInfo::dobj, _indexAttachInfo::dobj, _dumpableObject::dumpId, findIndexByOid(), i, _tableInfo::indexes, _indxInfo::indextable, j, _dumpableObject::name, _tableInfo::numIndexes, _dumpableObject::objType, CatalogId::oid, _indexAttachInfo::parentIdx, _indxInfo::partattaches, _indexAttachInfo::partitionIdx, pg_malloc_object, pg_strdup(), simple_ptr_list_append(), and CatalogId::tableoid.
|
static |
Definition at line 268 of file common.c.
References addObjectDependency(), AssignDumpId(), _dumpableObject::catId, DO_TABLE_ATTACH, _tableInfo::dobj, _tableAttachInfo::dobj, DUMP_COMPONENT_DEFINITION, _dumpableObject::dumpId, findTableByOid(), i, _inhInfo::inhparent, _inhInfo::inhrelid, _tableInfo::ispartition, j, _dumpableObject::name, _tableInfo::numParents, _dumpableObject::objType, CatalogId::oid, palloc(), _tableInfo::parents, _tableAttachInfo::parentTbl, _tableAttachInfo::partitionTbl, pg_fatal, pg_malloc_array, pg_realloc_array, pg_strdup(), and CatalogId::tableoid.
Referenced by getSchemaData().
void getDumpableObjects | ( | DumpableObject *** | objs, |
int * | numObjs | ||
) |
Definition at line 774 of file common.c.
References allocedDumpIds, dumpIdMap, i, j, and pg_malloc_array.
Referenced by getTableDataFKConstraints(), and main().
DumpId getMaxDumpId | ( | void | ) |
Definition at line 731 of file common.c.
References lastDumpId.
Referenced by findDependencyLoops(), and TopoSort().
Definition at line 97 of file common.c.
References Archive::dopt, flagInhAttrs(), flagInhIndexes(), flagInhTables(), free, getAccessMethods(), getAggregates(), getCasts(), getCollations(), getConstraints(), getConversions(), getDefaultACLs(), getEventTriggers(), getExtendedStatistics(), getExtensionMembership(), getExtensions(), getForeignDataWrappers(), getForeignServers(), getFuncs(), getIndexes(), getInherits(), getNamespaces(), getOpclasses(), getOperators(), getOpfamilies(), getOwnedSeqs(), getPartitioningInfo(), getPolicies(), getProcLangs(), getPublicationNamespaces(), getPublications(), getPublicationTables(), getRules(), getSubscriptions(), getSubscriptionTables(), getTableAttrs(), getTables(), getTransforms(), getTriggers(), getTSConfigurations(), getTSDictionaries(), getTSParsers(), getTSTemplates(), getTypes(), pg_log_info, and processExtensionTables().
Referenced by main().
void parseOidArray | ( | const char * | str, |
Oid * | array, | ||
int | arraysize | ||
) |
Definition at line 1070 of file common.c.
References atooid, InvalidOid, j, pg_fatal, and str.
Referenced by dumpFunc(), getAggregates(), getFuncs(), and getIndexes().
void recordAdditionalCatalogID | ( | CatalogId | catId, |
DumpableObject * | dobj | ||
) |
Definition at line 696 of file common.c.
References Assert, catalogIdHash, _catalogIdMapEntry::dobj, and _catalogIdMapEntry::ext.
Referenced by getLOs().
void recordExtensionMembership | ( | CatalogId | catId, |
ExtensionInfo * | ext | ||
) |
Definition at line 1022 of file common.c.
References Assert, catalogIdHash, _catalogIdMapEntry::dobj, and _catalogIdMapEntry::ext.
Referenced by getExtensionMembership().
void removeObjectDependency | ( | DumpableObject * | dobj, |
DumpId | refId | ||
) |
Definition at line 820 of file common.c.
References _dumpableObject::dependencies, i, j, and _dumpableObject::nDeps.
Referenced by repairDependencyLoop(), repairDomainConstraintLoop(), repairDomainConstraintMultiLoop(), repairFunctionBoundaryMultiLoop(), repairIndexLoop(), repairMatViewBoundaryMultiLoop(), repairTableAttrDefLoop(), repairTableAttrDefMultiLoop(), repairTableConstraintLoop(), repairTableConstraintMultiLoop(), repairTypeFuncLoop(), repairViewRuleLoop(), and repairViewRuleMultiLoop().
|
static |
|
static |
Definition at line 37 of file common.c.
Referenced by AssignDumpId(), findObjectByDumpId(), and getDumpableObjects().
|
static |
Definition at line 81 of file common.c.
Referenced by AssignDumpId(), findObjectByCatalogId(), findOwningExtension(), recordAdditionalCatalogID(), and recordExtensionMembership().
|
static |
Definition at line 36 of file common.c.
Referenced by AssignDumpId(), findObjectByDumpId(), and getDumpableObjects().
|
static |
Definition at line 38 of file common.c.
Referenced by AssignDumpId(), createDumpId(), and getMaxDumpId().