|
PostgreSQL Source Code git master
|
#include "postgres_fe.h"#include <ctype.h>#include "catalog/pg_am_d.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_RAW_ALLOCATOR pg_malloc0 |
| void addObjectDependency | ( | DumpableObject * | dobj, |
| DumpId | refId | ||
| ) |
Definition at line 819 of file common.c.
References _dumpableObject::allocDeps, _dumpableObject::dependencies, fb(), _dumpableObject::nDeps, pg_malloc_array, and pg_realloc_array.
Referenced by addBoundaryDependencies(), addConstrChildIdxDeps(), buildMatViewRefreshDependencies(), checkExtensionMembership(), flagInhAttrs(), flagInhIndexes(), flagInhTables(), getDependencies(), getDomainConstraints(), getIndexes(), getRules(), getTableAttrs(), getTableDataFKConstraints(), makeTableDataInfo(), processExtensionTables(), repairDomainConstraintMultiLoop(), repairTableAttrDefMultiLoop(), repairTableConstraintMultiLoop(), repairTypeFuncLoop(), and repairViewRuleMultiLoop().
| void AssignDumpId | ( | DumpableObject * | dobj | ) |
Definition at line 658 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, fb(), 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(), getRelationStatistics(), getRules(), getSubscriptionRelations(), getSubscriptions(), getTableAttrs(), getTables(), getTransforms(), getTriggers(), getTSConfigurations(), getTSDictionaries(), getTSParsers(), getTSTemplates(), getTypes(), and makeTableDataInfo().
Definition at line 746 of file common.c.
References lastDumpId.
Referenced by dumpACL(), dumpCommentExtended(), dumpCompositeTypeColComments(), dumpDatabase(), dumpEncoding(), dumpRelationStats(), dumpSearchPath(), dumpSecLabel(), dumpSequence(), dumpSequenceData(), dumpStatisticsExtStats(), dumpStdStrings(), dumpTableComment(), dumpTableSchema(), dumpTableSecLabel(), and dumpUserMappings().
| AccessMethodInfo * findAccessMethodByOid | ( | Oid | oid | ) |
Definition at line 955 of file common.c.
References Assert, DO_ACCESS_METHOD, fb(), findObjectByCatalogId(), _dumpableObject::objType, CatalogId::oid, and CatalogId::tableoid.
Referenced by accessMethodNameCompare().
Definition at line 973 of file common.c.
References Assert, DO_COLLATION, fb(), findObjectByCatalogId(), _dumpableObject::objType, CatalogId::oid, and CatalogId::tableoid.
Referenced by createDummyViewAsClause(), dumpCompositeType(), dumpDomain(), dumpRangeType(), and dumpTableSchema().
| ExtensionInfo * findExtensionByOid | ( | Oid | oid | ) |
Definition at line 1009 of file common.c.
References Assert, DO_EXTENSION, fb(), findObjectByCatalogId(), _dumpableObject::objType, CatalogId::oid, and CatalogId::tableoid.
Referenced by getExtensionMembership().
Definition at line 919 of file common.c.
References Assert, DO_FUNC, fb(), findObjectByCatalogId(), _dumpableObject::objType, CatalogId::oid, and CatalogId::tableoid.
Referenced by dumpCast(), dumpProcLang(), and dumpTransform().
Definition at line 882 of file common.c.
References Assert, DO_INDEX, fb(), findObjectByCatalogId(), _dumpableObject::objType, CatalogId::oid, and CatalogId::tableoid.
Referenced by flagInhIndexes().
| NamespaceInfo * findNamespaceByOid | ( | Oid | oid | ) |
Definition at line 991 of file common.c.
References Assert, DO_NAMESPACE, fb(), findObjectByCatalogId(), _dumpableObject::objType, CatalogId::oid, and CatalogId::tableoid.
Referenced by findNamespace(), and getPublicationNamespaces().
| DumpableObject * findObjectByCatalogId | ( | CatalogId | catalogId | ) |
Definition at line 779 of file common.c.
References catalogIdHash, _catalogIdMapEntry::dobj, and fb().
Referenced by buildMatViewRefreshDependencies(), collectComments(), collectSecLabels(), findAccessMethodByOid(), findCollationByOid(), findExtensionByOid(), findFuncByOid(), findIndexByOid(), findNamespaceByOid(), findOprByOid(), findPublicationByOid(), findSubscriptionByOid(), findTableByOid(), findTypeByOid(), getAdditionalACLs(), and getDependencies().
| DumpableObject * findObjectByDumpId | ( | DumpId | dumpId | ) |
Definition at line 766 of file common.c.
References allocedDumpIds, dumpIdMap, and fb().
Referenced by binary_upgrade_extension_member(), BuildArchiveDependencies(), dumpConstraint(), dumpDumpableObject(), dumpExtension(), findDumpableDependencies(), and findLoop().
Definition at line 937 of file common.c.
References Assert, DO_OPERATOR, fb(), findObjectByCatalogId(), _dumpableObject::objType, CatalogId::oid, and CatalogId::tableoid.
Referenced by getFormattedOperatorName().
| ExtensionInfo * findOwningExtension | ( | CatalogId | catalogId | ) |
Definition at line 1088 of file common.c.
References catalogIdHash, _catalogIdMapEntry::ext, and fb().
Referenced by checkExtensionMembership().
| PublicationInfo * findPublicationByOid | ( | Oid | oid | ) |
Definition at line 1027 of file common.c.
References Assert, DO_PUBLICATION, fb(), findObjectByCatalogId(), _dumpableObject::objType, CatalogId::oid, and CatalogId::tableoid.
Referenced by getPublicationNamespaces(), and getPublicationTables().
| SubscriptionInfo * findSubscriptionByOid | ( | Oid | oid | ) |
Definition at line 1045 of file common.c.
References Assert, DO_SUBSCRIPTION, fb(), findObjectByCatalogId(), _dumpableObject::objType, CatalogId::oid, and CatalogId::tableoid.
Referenced by getSubscriptionRelations().
Definition at line 864 of file common.c.
References Assert, DO_TABLE, fb(), findObjectByCatalogId(), _dumpableObject::objType, CatalogId::oid, and CatalogId::tableoid.
Referenced by dumpSequence(), flagInhTables(), getAdditionalACLs(), getConstraints(), getExtendedStatistics(), getOwnedSeqs(), getPartitioningInfo(), getPolicies(), getPublications(), getPublicationTables(), getRules(), getSubscriptionRelations(), getTableDataFKConstraints(), main(), processExtensionTables(), and selectDumpableType().
Definition at line 900 of file common.c.
References Assert, DO_DUMMY_TYPE, DO_TYPE, fb(), findObjectByCatalogId(), _dumpableObject::objType, CatalogId::oid, and CatalogId::tableoid.
Referenced by binary_upgrade_set_type_oids_by_type_oid(), collectComments(), collectSecLabels(), getCasts(), getFormattedTypeName(), getTransforms(), and pgTypeNameCompare().
|
static |
Definition at line 478 of file common.c.
References addObjectDependency(), AssignDumpId(), _tableInfo::attgenerated, _tableInfo::attnames, _tableInfo::attrdefs, _dumpOptions::binary_upgrade, DO_ATTRDEF, DUMP_COMPONENT_NONE, fb(), fout, i, j, _tableInfo::notnull_constrs, _tableInfo::notnull_invalid, _tableInfo::numatts, _tableInfo::numParents, _tableInfo::parents, pg_malloc_object, pg_strdup(), Archive::remoteVersion, shouldPrintColumn(), and strInArray().
Referenced by getSchemaData().
Referenced by getSchemaData().
Definition at line 387 of file common.c.
References addObjectDependency(), Assert, AssignDumpId(), DO_INDEX_ATTACH, _tableInfo::dobj, _indxInfo::dobj, _dumpableObject::dumpId, fb(), findIndexByOid(), i, _tableInfo::indexes, _indxInfo::indextable, j, _tableInfo::numIndexes, _indxInfo::partattaches, pg_malloc_object, pg_strdup(), and simple_ptr_list_append().
|
static |
Definition at line 269 of file common.c.
References addObjectDependency(), AssignDumpId(), _dumpableObject::catId, DO_TABLE_ATTACH, _tableInfo::dobj, DUMP_COMPONENT_DEFINITION, _dumpableObject::dumpId, fb(), findTableByOid(), i, _tableInfo::ispartition, j, _dumpableObject::name, _tableInfo::numParents, CatalogId::oid, palloc_object, _tableInfo::parents, pg_fatal, pg_malloc_array, pg_realloc_array, and pg_strdup().
Referenced by getSchemaData().
| void getDumpableObjects | ( | DumpableObject *** | objs, |
| int * | numObjs | ||
| ) |
Definition at line 798 of file common.c.
References allocedDumpIds, dumpIdMap, fb(), i, j, and pg_malloc_array.
Referenced by getTableDataFKConstraints(), and main().
Definition at line 755 of file common.c.
References lastDumpId.
Referenced by findDependencyLoops(), and TopoSort().
Definition at line 98 of file common.c.
References Archive::dopt, fb(), flagInhAttrs(), flagInhIndexes(), flagInhTables(), fout, 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(), getSubscriptionRelations(), getSubscriptions(), getTableAttrs(), getTables(), getTransforms(), getTriggers(), getTSConfigurations(), getTSDictionaries(), getTSParsers(), getTSTemplates(), getTypes(), pg_log_info, and processExtensionTables().
Referenced by main().
Definition at line 1112 of file common.c.
References atooid, fb(), InvalidOid, j, pg_fatal, and str.
Referenced by dumpFunc(), getAggregates(), getFuncs(), and getIndexes().
| void recordAdditionalCatalogID | ( | CatalogId | catId, |
| DumpableObject * | dobj | ||
| ) |
Definition at line 720 of file common.c.
References Assert, catalogIdHash, _catalogIdMapEntry::dobj, _catalogIdMapEntry::ext, and fb().
Referenced by getLOs().
| void recordExtensionMembership | ( | CatalogId | catId, |
| ExtensionInfo * | ext | ||
| ) |
Definition at line 1064 of file common.c.
References Assert, catalogIdHash, _catalogIdMapEntry::dobj, _catalogIdMapEntry::ext, and fb().
Referenced by getExtensionMembership().
| void removeObjectDependency | ( | DumpableObject * | dobj, |
| DumpId | refId | ||
| ) |
Definition at line 844 of file common.c.
References _dumpableObject::dependencies, fb(), i, j, and _dumpableObject::nDeps.
Referenced by repairDependencyLoop(), repairDomainConstraintLoop(), repairDomainConstraintMultiLoop(), repairFunctionBoundaryMultiLoop(), repairIndexLoop(), repairMatViewBoundaryMultiLoop(), repairTableAttrDefLoop(), repairTableAttrDefMultiLoop(), repairTableConstraintLoop(), repairTableConstraintMultiLoop(), repairTypeFuncLoop(), repairViewRuleLoop(), and repairViewRuleMultiLoop().
|
static |
Definition at line 38 of file common.c.
Referenced by AssignDumpId(), findObjectByDumpId(), and getDumpableObjects().
|
static |
Definition at line 82 of file common.c.
Referenced by AssignDumpId(), findObjectByCatalogId(), findOwningExtension(), recordAdditionalCatalogID(), and recordExtensionMembership().
|
static |
Definition at line 37 of file common.c.
Referenced by AssignDumpId(), findObjectByDumpId(), and getDumpableObjects().
|
static |
Definition at line 39 of file common.c.
Referenced by AssignDumpId(), createDumpId(), and getMaxDumpId().