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 775 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 638 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(), getTableAttrs(), getTables(), getTransforms(), getTriggers(), getTSConfigurations(), getTSDictionaries(), getTSParsers(), getTSTemplates(), getTypes(), and makeTableDataInfo().
DumpId createDumpId | ( | void | ) |
Definition at line 702 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 911 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 947 of file common.c.
References Assert(), DO_EXTENSION, findObjectByCatalogId(), _dumpableObject::objType, CatalogId::oid, and CatalogId::tableoid.
Referenced by getExtensionMembership().
Definition at line 875 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 838 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 929 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 735 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 722 of file common.c.
References allocedDumpIds, and dumpIdMap.
Referenced by binary_upgrade_extension_member(), BuildArchiveDependencies(), dumpConstraint(), dumpExtension(), findDumpableDependencies(), and findLoop().
Definition at line 893 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 1008 of file common.c.
References catalogIdHash, and _catalogIdMapEntry::ext.
Referenced by checkExtensionMembership().
PublicationInfo* findPublicationByOid | ( | Oid | oid | ) |
Definition at line 965 of file common.c.
References Assert(), DO_PUBLICATION, findObjectByCatalogId(), _dumpableObject::objType, CatalogId::oid, and CatalogId::tableoid.
Referenced by getPublicationNamespaces(), and getPublicationTables().
Definition at line 820 of file common.c.
References Assert(), DO_TABLE, findObjectByCatalogId(), _dumpableObject::objType, CatalogId::oid, and CatalogId::tableoid.
Referenced by dumpSequence(), flagInhTables(), getAdditionalACLs(), getConstraints(), getOwnedSeqs(), getPartitioningInfo(), getPolicies(), getPublicationTables(), getRules(), getTableDataFKConstraints(), processExtensionTables(), and selectDumpableType().
Definition at line 856 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 494 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::inhNotNull, _tableInfo::ispartition, j, _dumpableObject::name, _tableInfo::notnull, _tableInfo::numatts, _tableInfo::numParents, _dumpableObject::objType, CatalogId::oid, _tableInfo::parents, pg_malloc_object, pg_strdup(), _tableInfo::relkind, _attrDefInfo::separate, shouldPrintColumn(), strInArray(), and CatalogId::tableoid.
Referenced by getSchemaData().
Referenced by getSchemaData().
Definition at line 404 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 286 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 754 of file common.c.
References allocedDumpIds, dumpIdMap, i, j, and pg_malloc_array.
Referenced by getTableDataFKConstraints(), and main().
DumpId getMaxDumpId | ( | void | ) |
Definition at line 711 of file common.c.
References lastDumpId.
Referenced by findDependencyLoops(), and TopoSort().
Definition at line 95 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(), 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 1032 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 984 of file common.c.
References Assert(), catalogIdHash, _catalogIdMapEntry::dobj, and _catalogIdMapEntry::ext.
Referenced by getExtensionMembership().
void removeObjectDependency | ( | DumpableObject * | dobj, |
DumpId | refId | ||
) |
Definition at line 800 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().