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_type_d.h"
#include "common/hashfn.h"
#include "fe_utils/string_utils.h"
#include "pg_backup_archiver.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 720 of file common.c.
References _dumpableObject::allocDeps, _dumpableObject::dependencies, _dumpableObject::nDeps, pg_malloc(), and pg_realloc().
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 580 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(), pg_realloc(), and CatalogId::tableoid.
Referenced by createBoundaryObjects(), flagInhAttrs(), flagInhIndexes(), flagInhTables(), getAccessMethods(), getAggregates(), getBlobs(), getCasts(), getCollations(), getConstraints(), getConversions(), getDefaultACLs(), getDomainConstraints(), getEventTriggers(), getExtendedStatistics(), getExtensions(), getForeignDataWrappers(), getForeignServers(), getFuncs(), getIndexes(), getNamespaces(), getOpclasses(), getOperators(), getOpfamilies(), getPolicies(), getProcLangs(), getPublicationNamespaces(), getPublications(), getPublicationTables(), getRules(), getSubscriptions(), getTableAttrs(), getTables(), getTransforms(), getTriggers(), getTSConfigurations(), getTSDictionaries(), getTSParsers(), getTSTemplates(), getTypes(), and makeTableDataInfo().
DumpId createDumpId | ( | void | ) |
Definition at line 646 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 858 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 894 of file common.c.
References Assert(), DO_EXTENSION, findObjectByCatalogId(), _dumpableObject::objType, CatalogId::oid, and CatalogId::tableoid.
Referenced by getExtensionMembership().
Definition at line 822 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 785 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 876 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 679 of file common.c.
References catalogIdHash, and _catalogIdMapEntry::dobj.
Referenced by buildMatViewRefreshDependencies(), collectComments(), collectSecLabels(), findCollationByOid(), findExtensionByOid(), findFuncByOid(), findIndexByOid(), findNamespaceByOid(), findOprByOid(), findPublicationByOid(), findTableByOid(), findTypeByOid(), getAdditionalACLs(), and getDependencies().
DumpableObject* findObjectByDumpId | ( | DumpId | dumpId | ) |
Definition at line 666 of file common.c.
References allocedDumpIds, and dumpIdMap.
Referenced by binary_upgrade_extension_member(), BuildArchiveDependencies(), dumpConstraint(), dumpExtension(), findDumpableDependencies(), and findLoop().
Definition at line 840 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 955 of file common.c.
References catalogIdHash, and _catalogIdMapEntry::ext.
Referenced by checkExtensionMembership().
Definition at line 974 of file common.c.
References findTableByOid(), i, j, _tableInfo::parents, pg_fatal, and pg_malloc().
Referenced by flagInhTables().
PublicationInfo* findPublicationByOid | ( | Oid | oid | ) |
Definition at line 912 of file common.c.
References Assert(), DO_PUBLICATION, findObjectByCatalogId(), _dumpableObject::objType, CatalogId::oid, and CatalogId::tableoid.
Referenced by getPublicationNamespaces(), and getPublicationTables().
Definition at line 767 of file common.c.
References Assert(), DO_TABLE, findObjectByCatalogId(), _dumpableObject::objType, CatalogId::oid, and CatalogId::tableoid.
Referenced by dumpSequence(), findParentsByOid(), getAdditionalACLs(), getConstraints(), getOwnedSeqs(), getPolicies(), getPublicationTables(), getRules(), getTableDataFKConstraints(), processExtensionTables(), and selectDumpableType().
Definition at line 803 of file common.c.
References Assert(), DO_DUMMY_TYPE, DO_TYPE, findObjectByCatalogId(), _dumpableObject::objType, CatalogId::oid, and CatalogId::tableoid.
Referenced by collectComments(), collectSecLabels(), DOTypeNameCompare(), getCasts(), getFormattedTypeName(), and getTransforms().
|
static |
Definition at line 467 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, _dumpableObject::dumpId, i, _tableInfo::inhNotNull, _tableInfo::ispartition, j, _dumpableObject::name, _tableInfo::notnull, _tableInfo::numatts, _tableInfo::numParents, _dumpableObject::objType, CatalogId::oid, _tableInfo::parents, pg_malloc(), pg_strdup(), _tableInfo::relkind, _attrDefInfo::separate, shouldPrintColumn(), strInArray(), and CatalogId::tableoid.
Referenced by getSchemaData().
Referenced by getSchemaData().
Definition at line 378 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(), pg_strdup(), simple_ptr_list_append(), and CatalogId::tableoid.
|
static |
Definition at line 285 of file common.c.
References addObjectDependency(), AssignDumpId(), _dumpableObject::catId, DO_TABLE_ATTACH, _tableInfo::dobj, _tableAttachInfo::dobj, Archive::dopt, _dumpableObject::dumpId, findParentsByOid(), i, _tableInfo::ispartition, j, _dumpOptions::load_via_partition_root, _dumpableObject::name, _tableInfo::numParents, _dumpableObject::objType, CatalogId::oid, palloc(), _tableInfo::parents, _tableAttachInfo::parentTbl, _tableAttachInfo::partitionTbl, pg_fatal, pg_strdup(), and CatalogId::tableoid.
Referenced by getSchemaData().
void getDumpableObjects | ( | DumpableObject *** | objs, |
int * | numObjs | ||
) |
Definition at line 698 of file common.c.
References allocedDumpIds, dumpIdMap, i, j, and pg_malloc().
Referenced by getTableDataFKConstraints(), and main().
DumpId getMaxDumpId | ( | void | ) |
Definition at line 655 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(), getPolicies(), getProcLangs(), getPublicationNamespaces(), getPublications(), getPublicationTables(), getRules(), getSubscriptions(), 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 1026 of file common.c.
References atooid, InvalidOid, j, pg_fatal, and generate_unaccent_rules::str.
Referenced by dumpFunc(), getAggregates(), getFuncs(), and getIndexes().
void recordExtensionMembership | ( | CatalogId | catId, |
ExtensionInfo * | ext | ||
) |
Definition at line 931 of file common.c.
References Assert(), catalogIdHash, _catalogIdMapEntry::dobj, and _catalogIdMapEntry::ext.
Referenced by getExtensionMembership().
void removeObjectDependency | ( | DumpableObject * | dobj, |
DumpId | refId | ||
) |
Definition at line 747 of file common.c.
References _dumpableObject::dependencies, i, j, and _dumpableObject::nDeps.
Referenced by repairDependencyLoop(), repairDomainConstraintLoop(), repairDomainConstraintMultiLoop(), repairIndexLoop(), repairMatViewBoundaryMultiLoop(), repairTableAttrDefLoop(), repairTableAttrDefMultiLoop(), repairTableConstraintLoop(), repairTableConstraintMultiLoop(), repairTypeFuncLoop(), repairViewRuleLoop(), and repairViewRuleMultiLoop().
|
static |
|
static |
Definition at line 38 of file common.c.
Referenced by AssignDumpId(), findObjectByDumpId(), and getDumpableObjects().
|
static |
Definition at line 80 of file common.c.
Referenced by AssignDumpId(), findObjectByCatalogId(), findOwningExtension(), 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().