PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/genam.h"
#include "access/multixact.h"
#include "access/relation.h"
#include "access/table.h"
#include "access/tableam.h"
#include "catalog/binary_upgrade.h"
#include "catalog/catalog.h"
#include "catalog/heap.h"
#include "catalog/index.h"
#include "catalog/objectaccess.h"
#include "catalog/partition.h"
#include "catalog/pg_am.h"
#include "catalog/pg_attrdef.h"
#include "catalog/pg_collation.h"
#include "catalog/pg_constraint.h"
#include "catalog/pg_foreign_table.h"
#include "catalog/pg_inherits.h"
#include "catalog/pg_namespace.h"
#include "catalog/pg_opclass.h"
#include "catalog/pg_partitioned_table.h"
#include "catalog/pg_statistic.h"
#include "catalog/pg_subscription_rel.h"
#include "catalog/pg_tablespace.h"
#include "catalog/pg_type.h"
#include "catalog/storage.h"
#include "commands/tablecmds.h"
#include "commands/typecmds.h"
#include "common/int.h"
#include "miscadmin.h"
#include "nodes/nodeFuncs.h"
#include "optimizer/optimizer.h"
#include "parser/parse_coerce.h"
#include "parser/parse_collate.h"
#include "parser/parse_expr.h"
#include "parser/parse_relation.h"
#include "parser/parsetree.h"
#include "partitioning/partdesc.h"
#include "pgstat.h"
#include "storage/lmgr.h"
#include "storage/predicate.h"
#include "utils/builtins.h"
#include "utils/fmgroids.h"
#include "utils/inval.h"
#include "utils/lsyscache.h"
#include "utils/syscache.h"
Go to the source code of this file.
Functions | |
static void | AddNewRelationTuple (Relation pg_class_desc, Relation new_rel_desc, Oid new_rel_oid, Oid new_type_oid, Oid reloftype, Oid relowner, char relkind, TransactionId relfrozenxid, TransactionId relminmxid, Datum relacl, Datum reloptions) |
static ObjectAddress | AddNewRelationType (const char *typeName, Oid typeNamespace, Oid new_rel_oid, char new_rel_kind, Oid ownerid, Oid new_row_type, Oid new_array_type) |
static void | RelationRemoveInheritance (Oid relid) |
static Oid | StoreRelCheck (Relation rel, const char *ccname, Node *expr, bool is_validated, bool is_local, int16 inhcount, bool is_no_inherit, bool is_internal) |
static void | StoreConstraints (Relation rel, List *cooked_constraints, bool is_internal) |
static bool | MergeWithExistingConstraint (Relation rel, const char *ccname, Node *expr, bool allow_merge, bool is_local, bool is_initially_valid, bool is_no_inherit) |
static void | SetRelationNumChecks (Relation rel, int numchecks) |
static Node * | cookConstraint (ParseState *pstate, Node *raw_constraint, char *relname) |
const FormData_pg_attribute * | SystemAttributeDefinition (AttrNumber attno) |
const FormData_pg_attribute * | SystemAttributeByName (const char *attname) |
Relation | heap_create (const char *relname, Oid relnamespace, Oid reltablespace, Oid relid, RelFileNumber relfilenumber, Oid accessmtd, TupleDesc tupDesc, char relkind, char relpersistence, bool shared_relation, bool mapped_relation, bool allow_system_table_mods, TransactionId *relfrozenxid, MultiXactId *relminmxid, bool create_storage) |
void | CheckAttributeNamesTypes (TupleDesc tupdesc, char relkind, int flags) |
void | CheckAttributeType (const char *attname, Oid atttypid, Oid attcollation, List *containing_rowtypes, int flags) |
void | InsertPgAttributeTuples (Relation pg_attribute_rel, TupleDesc tupdesc, Oid new_rel_oid, const FormExtraData_pg_attribute tupdesc_extra[], CatalogIndexState indstate) |
static void | AddNewAttributeTuples (Oid new_rel_oid, TupleDesc tupdesc, char relkind) |
void | InsertPgClassTuple (Relation pg_class_desc, Relation new_rel_desc, Oid new_rel_oid, Datum relacl, Datum reloptions) |
Oid | heap_create_with_catalog (const char *relname, Oid relnamespace, Oid reltablespace, Oid relid, Oid reltypeid, Oid reloftypeid, Oid ownerid, Oid accessmtd, TupleDesc tupdesc, List *cooked_constraints, char relkind, char relpersistence, bool shared_relation, bool mapped_relation, OnCommitAction oncommit, Datum reloptions, bool use_user_acl, bool allow_system_table_mods, bool is_internal, Oid relrewrite, ObjectAddress *typaddress) |
void | DeleteRelationTuple (Oid relid) |
void | DeleteAttributeTuples (Oid relid) |
void | DeleteSystemAttributeTuples (Oid relid) |
void | RemoveAttributeById (Oid relid, AttrNumber attnum) |
void | heap_drop_with_catalog (Oid relid) |
void | RelationClearMissing (Relation rel) |
void | SetAttrMissing (Oid relid, char *attname, char *value) |
List * | AddRelationNewConstraints (Relation rel, List *newColDefaults, List *newConstraints, bool allow_merge, bool is_local, bool is_internal, const char *queryString) |
static bool | check_nested_generated_walker (Node *node, void *context) |
static void | check_nested_generated (ParseState *pstate, Node *node) |
Node * | cookDefault (ParseState *pstate, Node *raw_default, Oid atttypid, int32 atttypmod, const char *attname, char attgenerated) |
void | CopyStatistics (Oid fromrelid, Oid torelid) |
void | RemoveStatistics (Oid relid, AttrNumber attnum) |
static void | RelationTruncateIndexes (Relation heapRelation) |
void | heap_truncate (List *relids) |
void | heap_truncate_one_rel (Relation rel) |
void | heap_truncate_check_FKs (List *relations, bool tempTables) |
List * | heap_truncate_find_FKs (List *relationIds) |
void | StorePartitionKey (Relation rel, char strategy, int16 partnatts, AttrNumber *partattrs, List *partexprs, Oid *partopclass, Oid *partcollation) |
void | RemovePartitionKeyByRelId (Oid relid) |
void | StorePartitionBound (Relation rel, Relation parent, PartitionBoundSpec *bound) |
Variables | |
Oid | binary_upgrade_next_heap_pg_class_oid = InvalidOid |
Oid | binary_upgrade_next_toast_pg_class_oid = InvalidOid |
RelFileNumber | binary_upgrade_next_heap_pg_class_relfilenumber = InvalidRelFileNumber |
RelFileNumber | binary_upgrade_next_toast_pg_class_relfilenumber = InvalidRelFileNumber |
static const FormData_pg_attribute | a1 |
static const FormData_pg_attribute | a2 |
static const FormData_pg_attribute | a3 |
static const FormData_pg_attribute | a4 |
static const FormData_pg_attribute | a5 |
static const FormData_pg_attribute | a6 |
static const FormData_pg_attribute *const | SysAtt [] = {&a1, &a2, &a3, &a4, &a5, &a6} |
Definition at line 820 of file heap.c.
References CatalogCloseIndexes(), CatalogOpenIndexes(), CreateTupleDesc(), DEPENDENCY_NORMAL, FormData_pg_attribute, FreeTupleDesc(), i, InsertPgAttributeTuples(), lengthof, TupleDescData::natts, ObjectAddressSet, ObjectAddressSubSet, OidIsValid, recordDependencyOn(), RowExclusiveLock, SysAtt, table_close(), table_open(), and TupleDescAttr.
Referenced by heap_create_with_catalog().
|
static |
Definition at line 969 of file heap.c.
References InsertPgClassTuple(), RelationData::rd_att, RelationData::rd_rel, TupleDescData::tdtypeid, and TupleDescData::tdtypmod.
Referenced by heap_create_with_catalog().
|
static |
Definition at line 1027 of file heap.c.
References DEFAULT_TYPDELIM, InvalidOid, and TypeCreate().
Referenced by heap_create_with_catalog().
List* AddRelationNewConstraints | ( | Relation | rel, |
List * | newColDefaults, | ||
List * | newConstraints, | ||
bool | allow_merge, | ||
bool | is_local, | ||
bool | is_internal, | ||
const char * | queryString | ||
) |
Definition at line 2259 of file heap.c.
References AccessShareLock, addNSItemToQuery(), addRangeTableEntryForRelation(), Assert, CookedConstraint::attnum, castNode, ChooseConstraintName(), CookedConstraint::conoid, TupleDescData::constr, CONSTR_CHECK, CONSTR_DEFAULT, contain_volatile_functions_after_planning(), CookedConstraint::contype, cookConstraint(), cookDefault(), ereport, errcode(), ERRCODE_DUPLICATE_OBJECT, errmsg(), ERROR, CookedConstraint::expr, foreach_node, foreach_ptr, get_attname(), CookedConstraint::inhcount, CookedConstraint::is_local, CookedConstraint::is_no_inherit, IsA, lappend(), linitial, list_length(), list_union(), make_parsestate(), MergeWithExistingConstraint(), CookedConstraint::name, NameStr, NIL, TupleConstr::num_check, ParseState::p_sourcetext, palloc(), pull_var_clause(), RelationData::rd_att, RelationGetDescr, RelationGetNamespace, RelationGetRelationName, RelationGetRelid, SetRelationNumChecks(), CookedConstraint::skip_validation, StoreAttrDefault(), StoreRelCheck(), stringToNode(), and TupleDescAttr.
Referenced by ATAddCheckConstraint(), ATExecAddColumn(), ATExecColumnDefault(), ATExecSetExpression(), and DefineRelation().
|
static |
Definition at line 2736 of file heap.c.
References check_nested_generated_walker().
Referenced by cookDefault().
Definition at line 2694 of file heap.c.
References attnum, context, ereport, errcode(), errdetail(), errmsg(), ERROR, expression_tree_walker, get_attgenerated(), get_attname(), IsA, Var::location, OidIsValid, ParseState::p_rtable, parser_errposition(), rt_fetch, Var::varattno, and Var::varno.
Referenced by check_nested_generated().
void CheckAttributeNamesTypes | ( | TupleDesc | tupdesc, |
char | relkind, | ||
int | flags | ||
) |
Definition at line 456 of file heap.c.
References attname, CheckAttributeType(), ereport, errcode(), errmsg(), ERROR, i, j, MaxHeapAttributeNumber, NameStr, TupleDescData::natts, NIL, SystemAttributeByName(), and TupleDescAttr.
Referenced by addRangeTableEntryForFunction(), and heap_create_with_catalog().
void CheckAttributeType | ( | const char * | attname, |
Oid | atttypid, | ||
Oid | attcollation, | ||
List * | containing_rowtypes, | ||
int | flags | ||
) |
Definition at line 548 of file heap.c.
References AccessShareLock, attname, check_stack_depth(), CHKATYPE_ANYARRAY, CHKATYPE_ANYRECORD, CHKATYPE_IS_PARTKEY, ereport, errcode(), errhint(), errmsg(), ERROR, format_type_be(), get_element_type(), get_range_collation(), get_range_subtype(), get_typ_typrelid(), get_typtype(), getBaseType(), i, lappend_oid(), list_delete_last(), list_member_oid(), NameStr, TupleDescData::natts, OidIsValid, relation_close(), relation_open(), RelationGetDescr, TupleDescAttr, and type_is_collatable().
Referenced by ATExecAddColumn(), ATPrepAlterColumnType(), CheckAttributeNamesTypes(), ComputePartitionAttrs(), and ConstructTupleDescriptor().
|
static |
Definition at line 2831 of file heap.c.
References assign_expr_collations(), coerce_to_boolean(), ereport, errcode(), errmsg(), ERROR, EXPR_KIND_CHECK_CONSTRAINT, list_length(), ParseState::p_rtable, relname, and transformExpr().
Referenced by AddRelationNewConstraints().
Node* cookDefault | ( | ParseState * | pstate, |
Node * | raw_default, | ||
Oid | atttypid, | ||
int32 | atttypmod, | ||
const char * | attname, | ||
char | attgenerated | ||
) |
Definition at line 2754 of file heap.c.
References Assert, assign_expr_collations(), attname, check_nested_generated(), COERCE_IMPLICIT_CAST, coerce_to_target_type(), COERCION_ASSIGNMENT, contain_mutable_functions_after_planning(), contain_var_clause(), ereport, errcode(), errhint(), errmsg(), ERROR, EXPR_KIND_COLUMN_DEFAULT, EXPR_KIND_GENERATED_COLUMN, exprType(), format_type_be(), OidIsValid, and transformExpr().
Referenced by AddRelationNewConstraints(), AlterDomainDefault(), and DefineDomain().
Definition at line 2869 of file heap.c.
References BTEqualStrategyNumber, CatalogCloseIndexes(), CatalogOpenIndexes(), CatalogTupleInsertWithInfo(), GETSTRUCT, heap_copytuple(), heap_freetuple(), HeapTupleIsValid, sort-test::key, ObjectIdGetDatum(), RowExclusiveLock, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), and table_open().
Referenced by index_concurrently_swap().
void DeleteAttributeTuples | ( | Oid | relid | ) |
Definition at line 1586 of file heap.c.
References BTEqualStrategyNumber, CatalogTupleDelete(), sort-test::key, ObjectIdGetDatum(), RowExclusiveLock, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), HeapTupleData::t_self, table_close(), and table_open().
Referenced by heap_drop_with_catalog(), and index_drop().
void DeleteRelationTuple | ( | Oid | relid | ) |
Definition at line 1557 of file heap.c.
References CatalogTupleDelete(), elog, ERROR, HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), RowExclusiveLock, SearchSysCache1(), HeapTupleData::t_self, table_close(), and table_open().
Referenced by heap_drop_with_catalog(), and index_drop().
void DeleteSystemAttributeTuples | ( | Oid | relid | ) |
Definition at line 1623 of file heap.c.
References BTEqualStrategyNumber, BTLessEqualStrategyNumber, CatalogTupleDelete(), Int16GetDatum(), sort-test::key, ObjectIdGetDatum(), RowExclusiveLock, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), HeapTupleData::t_self, table_close(), and table_open().
Relation heap_create | ( | const char * | relname, |
Oid | relnamespace, | ||
Oid | reltablespace, | ||
Oid | relid, | ||
RelFileNumber | relfilenumber, | ||
Oid | accessmtd, | ||
TupleDesc | tupDesc, | ||
char | relkind, | ||
char | relpersistence, | ||
bool | shared_relation, | ||
bool | mapped_relation, | ||
bool | allow_system_table_mods, | ||
TransactionId * | relfrozenxid, | ||
MultiXactId * | relminmxid, | ||
bool | create_storage | ||
) |
Definition at line 289 of file heap.c.
References Assert, ereport, errcode(), errdetail(), errmsg(), ERROR, get_namespace_name(), InvalidMultiXactId, InvalidOid, InvalidTransactionId, IsCatalogNamespace(), IsNormalProcessingMode, IsToastNamespace(), MyDatabaseTableSpace, OidIsValid, pgstat_create_relation(), RelationData::rd_locator, RelationData::rd_rel, recordDependencyOnTablespace(), RelationBuildLocalRelation(), RelationCreateStorage(), RelFileNumberIsValid, relname, and table_relation_set_new_filelocator().
Referenced by heap_create_with_catalog(), and index_create().
Oid heap_create_with_catalog | ( | const char * | relname, |
Oid | relnamespace, | ||
Oid | reltablespace, | ||
Oid | relid, | ||
Oid | reltypeid, | ||
Oid | reloftypeid, | ||
Oid | ownerid, | ||
Oid | accessmtd, | ||
TupleDesc | tupdesc, | ||
List * | cooked_constraints, | ||
char | relkind, | ||
char | relpersistence, | ||
bool | shared_relation, | ||
bool | mapped_relation, | ||
OnCommitAction | oncommit, | ||
Datum | reloptions, | ||
bool | use_user_acl, | ||
bool | allow_system_table_mods, | ||
bool | is_internal, | ||
Oid | relrewrite, | ||
ObjectAddress * | typaddress | ||
) |
Definition at line 1105 of file heap.c.
References AccessExclusiveLock, add_exact_object_address(), AddNewAttributeTuples(), AddNewRelationTuple(), AddNewRelationType(), Assert, AssignTypeArrayOid(), binary_upgrade_next_heap_pg_class_oid, binary_upgrade_next_heap_pg_class_relfilenumber, binary_upgrade_next_toast_pg_class_oid, binary_upgrade_next_toast_pg_class_relfilenumber, CheckAttributeNamesTypes(), CHKATYPE_ANYARRAY, CStringGetDatum(), DEFAULT_TYPDELIM, DEPENDENCY_NORMAL, elog, ereport, errcode(), ERRCODE_DUPLICATE_OBJECT, errhint(), errmsg(), ERROR, free_object_addresses(), get_relname_relid(), get_user_default_acl(), GetNewRelFileNumber(), GetSysCacheOid2, heap_create(), InvalidOid, InvalidRelFileNumber, InvokeObjectPostCreateHookArg, IsBinaryUpgrade, IsBootstrapProcessingMode, IsNormalProcessingMode, LockRelationOid(), makeArrayTypeName(), moveArrayTypeName(), new_object_addresses(), NoLock, OBJECT_SEQUENCE, OBJECT_TABLE, ObjectAddressSet, ObjectAddress::objectId, ObjectIdGetDatum(), OidIsValid, ONCOMMIT_NOOP, pfree(), PointerGetDatum(), RelationData::rd_att, RelationData::rd_rel, record_object_address_dependencies(), recordDependencyOnCurrentExtension(), recordDependencyOnNewAcl(), recordDependencyOnOwner(), register_on_commit_action(), RelationGetRelid, RelFileNumberIsValid, relname, RowExclusiveLock, StoreConstraints(), table_close(), table_open(), and TypeCreate().
Referenced by create_toast_table(), DefineRelation(), and make_new_heap().
void heap_drop_with_catalog | ( | Oid | relid | ) |
Definition at line 1765 of file heap.c.
References AccessExclusiveLock, CacheInvalidateRelcacheByRelid(), CatalogTupleDelete(), CheckTableForSerializableConflictIn(), CheckTableNotInUse(), DeleteAttributeTuples(), DeleteRelationTuple(), elog, ERROR, get_default_partition_oid(), get_partition_parent(), GETSTRUCT, HeapTupleIsValid, InvalidOid, LockRelationOid(), NoLock, ObjectIdGetDatum(), OidIsValid, pgstat_drop_relation(), RelationData::rd_rel, relation_close(), relation_open(), RelationDropStorage(), RelationForgetRelation(), RelationRemoveInheritance(), ReleaseSysCache(), remove_on_commit_action(), RemovePartitionKeyByRelId(), RemoveStatistics(), RemoveSubscriptionRel(), RowExclusiveLock, SearchSysCache1(), HeapTupleData::t_self, table_close(), table_open(), and update_default_partition_oid().
Referenced by doDeletion().
void heap_truncate | ( | List * | relids | ) |
Definition at line 3017 of file heap.c.
References AccessExclusiveLock, heap_truncate_check_FKs(), heap_truncate_one_rel(), lappend(), lfirst, lfirst_oid, NIL, NoLock, table_close(), and table_open().
Referenced by PreCommit_on_commit_actions().
Definition at line 3102 of file heap.c.
References ereport, errcode(), errdetail(), errhint(), errmsg(), ERROR, get_rel_name(), heap_truncate_find_FKs(), lappend_oid(), lfirst, lfirst_oid, list_make1_oid, list_member_oid(), NIL, RelationData::rd_rel, RelationGetRelid, and relname.
Referenced by ExecuteTruncateGuts(), and heap_truncate().
Definition at line 3197 of file heap.c.
References AccessShareLock, BTEqualStrategyNumber, GETSTRUCT, HeapTupleIsValid, InvalidOid, sort-test::key, lappend_oid(), lfirst_oid, list_append_unique_oid(), list_copy(), list_deduplicate_oid(), list_free(), list_member_oid(), list_oid_cmp(), list_sort(), NIL, ObjectIdGetDatum(), OidIsValid, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), and table_open().
Referenced by ExecuteTruncateGuts(), and heap_truncate_check_FKs().
void heap_truncate_one_rel | ( | Relation | rel | ) |
Definition at line 3058 of file heap.c.
References AccessExclusiveLock, NoLock, OidIsValid, RelationData::rd_rel, RelationTruncateIndexes(), table_close(), table_open(), and table_relation_nontransactional_truncate().
Referenced by ExecuteTruncateGuts(), and heap_truncate().
void InsertPgAttributeTuples | ( | Relation | pg_attribute_rel, |
TupleDesc | tupdesc, | ||
Oid | new_rel_oid, | ||
const FormExtraData_pg_attribute | tupdesc_extra[], | ||
CatalogIndexState | indstate | ||
) |
Definition at line 702 of file heap.c.
References FormExtraData_pg_attribute::attoptions, FormExtraData_pg_attribute::attstattarget, BoolGetDatum(), CatalogCloseIndexes(), CatalogOpenIndexes(), CatalogTuplesMultiInsertWithInfo(), CharGetDatum(), ExecClearTuple(), ExecDropSingleTupleTableSlot(), ExecStoreVirtualTuple(), FormData_pg_attribute, i, Int16GetDatum(), Int32GetDatum(), InvalidOid, NullableDatum::isnull, MakeSingleTupleTableSlot(), MAX_CATALOG_MULTI_INSERT_BYTES, Min, NameGetDatum(), TupleDescData::natts, ObjectIdGetDatum(), palloc(), pfree(), RelationGetDescr, TupleTableSlot::tts_isnull, TupleTableSlot::tts_values, TTSOpsHeapTuple, TupleDescAttr, and NullableDatum::value.
Referenced by AddNewAttributeTuples(), AppendAttributeTuples(), and ATExecAddColumn().
void InsertPgClassTuple | ( | Relation | pg_class_desc, |
Relation | new_rel_desc, | ||
Oid | new_rel_oid, | ||
Datum | relacl, | ||
Datum | reloptions | ||
) |
Definition at line 896 of file heap.c.
References BoolGetDatum(), CatalogTupleInsert(), CharGetDatum(), Float4GetDatum(), heap_form_tuple(), heap_freetuple(), Int16GetDatum(), Int32GetDatum(), MultiXactIdGetDatum(), NameGetDatum(), ObjectIdGetDatum(), RelationData::rd_rel, RelationGetDescr, TransactionIdGetDatum(), and values.
Referenced by AddNewRelationTuple(), and index_create().
|
static |
Definition at line 2507 of file heap.c.
References Assert, BTEqualStrategyNumber, CatalogTupleUpdate(), CStringGetDatum(), elog, equal(), ereport, errcode(), ERRCODE_DUPLICATE_OBJECT, errmsg(), ERROR, fastgetattr(), GETSTRUCT, heap_copytuple(), HeapTupleIsValid, InvalidOid, NOTICE, ObjectIdGetDatum(), pg_add_s16_overflow(), RelationData::rd_att, RelationData::rd_rel, RelationGetRelationName, RelationGetRelid, RowExclusiveLock, ScanKeyInit(), stringToNode(), systable_beginscan(), systable_endscan(), systable_getnext(), HeapTupleData::t_self, table_close(), table_open(), TextDatumGetCString, and val.
Referenced by AddRelationNewConstraints().
void RelationClearMissing | ( | Relation | rel | ) |
Definition at line 1945 of file heap.c.
References attnum, BoolGetDatum(), CatalogTupleUpdate(), elog, ERROR, GETSTRUCT, heap_freetuple(), heap_modify_tuple(), HeapTupleIsValid, Int16GetDatum(), ObjectIdGetDatum(), RelationGetDescr, RelationGetNumberOfAttributes, RelationGetRelid, ReleaseSysCache(), RowExclusiveLock, SearchSysCache2(), HeapTupleData::t_self, table_close(), and table_open().
Referenced by ATExecAlterColumnType(), ATExecSetExpression(), and finish_heap_swap().
|
static |
Definition at line 1524 of file heap.c.
References BTEqualStrategyNumber, CatalogTupleDelete(), HeapTupleIsValid, sort-test::key, ObjectIdGetDatum(), RowExclusiveLock, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), HeapTupleData::t_self, table_close(), and table_open().
Referenced by heap_drop_with_catalog().
|
static |
Definition at line 2969 of file heap.c.
References AccessExclusiveLock, BuildDummyIndexInfo(), index_build(), index_close(), index_open(), lfirst_oid, NoLock, RelationGetIndexList(), and RelationTruncate().
Referenced by heap_truncate_one_rel().
void RemoveAttributeById | ( | Oid | relid, |
AttrNumber | attnum | ||
) |
Definition at line 1664 of file heap.c.
References AccessExclusiveLock, attnum, CatalogTupleUpdate(), elog, ERROR, GETSTRUCT, heap_modify_tuple(), HeapTupleIsValid, Int16GetDatum(), InvalidOid, NAMEDATALEN, namestrcpy(), NoLock, ObjectIdGetDatum(), relation_close(), relation_open(), RelationGetDescr, RemoveStatistics(), RowExclusiveLock, SearchSysCacheCopy2, snprintf, HeapTupleData::t_self, table_close(), and table_open().
Referenced by doDeletion().
void RemovePartitionKeyByRelId | ( | Oid | relid | ) |
Definition at line 3449 of file heap.c.
References CatalogTupleDelete(), elog, ERROR, HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), RowExclusiveLock, SearchSysCache1(), HeapTupleData::t_self, table_close(), and table_open().
Referenced by heap_drop_with_catalog().
void RemoveStatistics | ( | Oid | relid, |
AttrNumber | attnum | ||
) |
Definition at line 2922 of file heap.c.
References attnum, BTEqualStrategyNumber, CatalogTupleDelete(), HeapTupleIsValid, Int16GetDatum(), sort-test::key, ObjectIdGetDatum(), RowExclusiveLock, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), HeapTupleData::t_self, table_close(), and table_open().
Referenced by ATExecAlterColumnType(), ATExecSetExpression(), heap_drop_with_catalog(), index_drop(), and RemoveAttributeById().
void SetAttrMissing | ( | Oid | relid, |
char * | attname, | ||
char * | value | ||
) |
Definition at line 2013 of file heap.c.
References AccessExclusiveLock, attname, BoolGetDatum(), CatalogTupleUpdate(), CStringGetDatum(), elog, ERROR, GETSTRUCT, heap_modify_tuple(), HeapTupleIsValid, Int32GetDatum(), ObjectIdGetDatum(), OidFunctionCall3, RelationData::rd_rel, RelationGetDescr, ReleaseSysCache(), RowExclusiveLock, SearchSysCacheAttName(), HeapTupleData::t_self, table_close(), table_open(), and value.
Referenced by binary_upgrade_set_missing_value().
|
static |
Definition at line 2660 of file heap.c.
References CacheInvalidateRelcache(), CatalogTupleUpdate(), elog, ERROR, GETSTRUCT, heap_freetuple(), HeapTupleIsValid, ObjectIdGetDatum(), RelationGetRelid, RowExclusiveLock, SearchSysCacheCopy1, HeapTupleData::t_self, table_close(), and table_open().
Referenced by AddRelationNewConstraints(), and StoreConstraints().
Definition at line 2185 of file heap.c.
References CookedConstraint::attnum, CommandCounterIncrement(), CookedConstraint::conoid, CONSTR_CHECK, CONSTR_DEFAULT, CookedConstraint::contype, elog, ERROR, CookedConstraint::expr, CookedConstraint::inhcount, CookedConstraint::is_local, CookedConstraint::is_no_inherit, lfirst, CookedConstraint::name, NIL, SetRelationNumChecks(), CookedConstraint::skip_validation, StoreAttrDefault(), and StoreRelCheck().
Referenced by heap_create_with_catalog().
void StorePartitionBound | ( | Relation | rel, |
Relation | parent, | ||
PartitionBoundSpec * | bound | ||
) |
Definition at line 3480 of file heap.c.
References Assert, CacheInvalidateRelcache(), CacheInvalidateRelcacheByRelid(), CatalogTupleUpdate(), CommandCounterIncrement(), CStringGetTextDatum, elog, ERROR, get_default_oid_from_partdesc(), GETSTRUCT, heap_freetuple(), heap_modify_tuple(), HeapTupleIsValid, PartitionBoundSpec::is_default, nodeToString(), ObjectIdGetDatum(), OidIsValid, RelationData::rd_rel, RelationGetDescr, RelationGetPartitionDesc(), RelationGetRelid, RowExclusiveLock, SearchSysCacheCopy1, SysCacheGetAttr(), HeapTupleData::t_self, table_close(), table_open(), and update_default_partition_oid().
Referenced by ATExecAttachPartition(), and DefineRelation().
void StorePartitionKey | ( | Relation | rel, |
char | strategy, | ||
int16 | partnatts, | ||
AttrNumber * | partattrs, | ||
List * | partexprs, | ||
Oid * | partopclass, | ||
Oid * | partcollation | ||
) |
Definition at line 3324 of file heap.c.
References add_exact_object_address(), Assert, buildint2vector(), buildoidvector(), CacheInvalidateRelcache(), CatalogTupleInsert(), CharGetDatum(), CStringGetTextDatum, DEPENDENCY_INTERNAL, DEPENDENCY_NORMAL, free_object_addresses(), heap_form_tuple(), i, Int16GetDatum(), InvalidOid, new_object_addresses(), nodeToString(), ObjectAddressSet, ObjectAddressSubSet, ObjectIdGetDatum(), OidIsValid, pfree(), PointerGetDatum(), RelationData::rd_rel, record_object_address_dependencies(), recordDependencyOn(), recordDependencyOnSingleRelExpr(), RelationGetDescr, RelationGetRelid, RowExclusiveLock, table_close(), table_open(), and values.
Referenced by DefineRelation().
|
static |
Definition at line 2074 of file heap.c.
References CreateConstraintEntry(), ereport, errcode(), errmsg(), ERROR, i, InvalidOid, j, lfirst, list_length(), nodeToString(), palloc(), pfree(), pull_var_clause(), RelationData::rd_rel, RelationGetNamespace, RelationGetRelationName, RelationGetRelid, and Var::varattno.
Referenced by AddRelationNewConstraints(), and StoreConstraints().
const FormData_pg_attribute* SystemAttributeByName | ( | const char * | attname | ) |
Definition at line 252 of file heap.c.
References attname, FormData_pg_attribute, j, lengthof, NameStr, and SysAtt.
Referenced by CheckAttributeNamesTypes(), expanded_record_lookup_field(), specialAttNum(), SPI_fnumber(), and transformIndexConstraint().
const FormData_pg_attribute* SystemAttributeDefinition | ( | AttrNumber | attno | ) |
Definition at line 240 of file heap.c.
References elog, ERROR, lengthof, and SysAtt.
Referenced by attnumAttName(), attnumTypeId(), build_index_tlist(), scanNSItemForColumn(), SPI_fname(), SPI_gettype(), SPI_gettypeid(), SPI_getvalue(), and transformIndexConstraint().
|
static |
Definition at line 142 of file heap.c.
Referenced by aclitem_eq(), aclitem_match(), aclitemComparator(), brin_minmax_multi_distance_float4(), brin_minmax_multi_distance_float8(), brin_minmax_multi_distance_int2(), brin_minmax_multi_distance_int4(), brin_minmax_multi_distance_int8(), brin_minmax_multi_distance_numeric(), brin_minmax_multi_distance_uuid(), build_distances(), cmpaffix(), deccall2(), deccall3(), distance_1D(), entryIndexByFrequencyCmp(), evalLazyFunc(), float8_qsort_cmp(), inet_merge(), inet_same_family(), int4gcd_internal(), int8gcd_internal(), macaddr8_cmp(), macaddr8_cmp_internal(), macaddr8_eq(), macaddr8_ge(), macaddr8_gt(), macaddr8_le(), macaddr8_lt(), macaddr8_ne(), macaddr_cmp(), macaddr_cmp_internal(), macaddr_eq(), macaddr_ge(), macaddr_gt(), macaddr_le(), macaddr_lt(), macaddr_ne(), MergeAffix(), network_cmp(), network_cmp_internal(), network_eq(), network_ge(), network_gt(), network_larger(), network_le(), network_lt(), network_ne(), network_overlap(), network_smaller(), network_sub(), network_subeq(), network_sup(), network_supeq(), packArcInfoCmp(), range_bound_qsort_cmp(), and sqrt_var().
|
static |
Definition at line 156 of file heap.c.
Referenced by aclitem_eq(), aclitem_match(), aclitemComparator(), brin_minmax_multi_distance_float4(), brin_minmax_multi_distance_float8(), brin_minmax_multi_distance_int2(), brin_minmax_multi_distance_int4(), brin_minmax_multi_distance_int8(), brin_minmax_multi_distance_numeric(), brin_minmax_multi_distance_uuid(), build_distances(), clonesuccessorstates(), cmpaffix(), deccall2(), deccall3(), distance_1D(), entryIndexByFrequencyCmp(), evalLazyFunc(), float8_qsort_cmp(), inet_merge(), inet_same_family(), int4gcd_internal(), int8gcd_internal(), macaddr8_cmp(), macaddr8_cmp_internal(), macaddr8_eq(), macaddr8_ge(), macaddr8_gt(), macaddr8_le(), macaddr8_lt(), macaddr8_ne(), macaddr_cmp(), macaddr_cmp_internal(), macaddr_eq(), macaddr_ge(), macaddr_gt(), macaddr_le(), macaddr_lt(), macaddr_ne(), MergeAffix(), network_cmp(), network_cmp_internal(), network_eq(), network_ge(), network_gt(), network_larger(), network_le(), network_lt(), network_ne(), network_overlap(), network_smaller(), network_sub(), network_subeq(), network_sup(), network_supeq(), packArcInfoCmp(), and range_bound_qsort_cmp().
|
static |
|
static |
|
static |
|
static |
Oid binary_upgrade_next_heap_pg_class_oid = InvalidOid |
Definition at line 80 of file heap.c.
Referenced by binary_upgrade_set_next_heap_pg_class_oid(), and heap_create_with_catalog().
RelFileNumber binary_upgrade_next_heap_pg_class_relfilenumber = InvalidRelFileNumber |
Definition at line 82 of file heap.c.
Referenced by binary_upgrade_set_next_heap_relfilenode(), heap_create_with_catalog(), and RelationSetNewRelfilenumber().
Oid binary_upgrade_next_toast_pg_class_oid = InvalidOid |
Definition at line 81 of file heap.c.
Referenced by binary_upgrade_set_next_toast_pg_class_oid(), create_toast_table(), and heap_create_with_catalog().
RelFileNumber binary_upgrade_next_toast_pg_class_relfilenumber = InvalidRelFileNumber |
Definition at line 83 of file heap.c.
Referenced by binary_upgrade_set_next_toast_relfilenode(), and heap_create_with_catalog().
Definition at line 232 of file heap.c.
Referenced by AddNewAttributeTuples(), SystemAttributeByName(), and SystemAttributeDefinition().