PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/genam.h"
#include "access/htup_details.h"
#include "access/multixact.h"
#include "access/relation.h"
#include "access/sysattr.h"
#include "access/table.h"
#include "access/tableam.h"
#include "access/transam.h"
#include "access/xact.h"
#include "access/xlog.h"
#include "catalog/binary_upgrade.h"
#include "catalog/catalog.h"
#include "catalog/dependency.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 "catalog/storage_xlog.h"
#include "commands/tablecmds.h"
#include "commands/typecmds.h"
#include "executor/executor.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 "storage/lmgr.h"
#include "storage/predicate.h"
#include "storage/smgr.h"
#include "utils/acl.h"
#include "utils/builtins.h"
#include "utils/datum.h"
#include "utils/fmgroids.h"
#include "utils/inval.h"
#include "utils/lsyscache.h"
#include "utils/partcache.h"
#include "utils/ruleutils.h"
#include "utils/snapmgr.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, int 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, Oid relfilenode, Oid accessmtd, TupleDesc tupDesc, char relkind, char relpersistence, bool shared_relation, bool mapped_relation, bool allow_system_table_mods, TransactionId *relfrozenxid, MultiXactId *relminmxid) |
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, Datum *attoptions, 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 | RemoveAttrDefault (Oid relid, AttrNumber attnum, DropBehavior behavior, bool complain, bool internal) |
void | RemoveAttrDefaultById (Oid attrdefId) |
void | heap_drop_with_catalog (Oid relid) |
void | RelationClearMissing (Relation rel) |
void | SetAttrMissing (Oid relid, char *attname, char *value) |
Oid | StoreAttrDefault (Relation rel, AttrNumber attnum, Node *expr, bool is_internal, bool add_column_mode) |
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 |
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 * | SysAtt [] = {&a1, &a2, &a3, &a4, &a5, &a6} |
Definition at line 842 of file heap.c.
References TupleDescData::attrs, CatalogCloseIndexes(), CatalogOpenIndexes(), CreateTupleDesc(), DEPENDENCY_NORMAL, FormData_pg_attribute, FreeTupleDesc(), i, InsertPgAttributeTuples(), lengthof, TupleDescData::natts, ObjectAddressSet, ObjectAddressSubSet, OidIsValid, recordDependencyOn(), RowExclusiveLock, SysAtt, table_close(), and table_open().
Referenced by heap_create_with_catalog().
|
static |
Definition at line 993 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 1064 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 2564 of file heap.c.
References AccessShareLock, addNSItemToQuery(), addRangeTableEntryForRelation(), Assert, RawColumnDefault::attnum, CookedConstraint::attnum, castNode, ChooseConstraintName(), Constraint::conname, CookedConstraint::conoid, TupleDescData::constr, CONSTR_CHECK, CONSTR_DEFAULT, contain_volatile_functions(), CookedConstraint::contype, Constraint::contype, cookConstraint(), cookDefault(), Constraint::cooked_expr, ereport, errcode(), ERRCODE_DUPLICATE_OBJECT, errmsg(), ERROR, CookedConstraint::expr, RawColumnDefault::generated, get_attname(), CookedConstraint::inhcount, Constraint::initially_valid, CookedConstraint::is_local, CookedConstraint::is_no_inherit, Constraint::is_no_inherit, IsA, lappend(), lfirst, linitial, list_length(), list_union(), make_parsestate(), MergeWithExistingConstraint(), RawColumnDefault::missingMode, CookedConstraint::name, NameStr, NIL, TupleConstr::num_check, ParseState::p_sourcetext, palloc(), pull_var_clause(), RawColumnDefault::raw_default, Constraint::raw_expr, RelationData::rd_att, RelationGetDescr, RelationGetNamespace, RelationGetRelationName, RelationGetRelid, SetRelationNumChecks(), CookedConstraint::skip_validation, Constraint::skip_validation, StoreAttrDefault(), StoreRelCheck(), stringToNode(), and TupleDescAttr.
Referenced by ATAddCheckConstraint(), ATExecAddColumn(), ATExecColumnDefault(), and DefineRelation().
|
static |
Definition at line 3029 of file heap.c.
References check_nested_generated_walker().
Referenced by cookDefault().
Definition at line 2998 of file heap.c.
References attnum, AttributeNumberIsValid, 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 498 of file heap.c.
References attname, CheckAttributeType(), ereport, errcode(), errmsg(), ERROR, i, 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 590 of file heap.c.
References AccessShareLock, CheckAttributeType(), 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(), CheckAttributeType(), ComputePartitionAttrs(), and ConstructTupleDescriptor().
|
static |
Definition at line 3122 of file heap.c.
References assign_expr_collations(), coerce_to_boolean(), ereport, errcode(), errmsg(), ERROR, EXPR_KIND_CHECK_CONSTRAINT, list_length(), ParseState::p_rtable, and transformExpr().
Referenced by AddRelationNewConstraints().
Node* cookDefault | ( | ParseState * | pstate, |
Node * | raw_default, | ||
Oid | atttypid, | ||
int32 | atttypmod, | ||
const char * | attname, | ||
char | attgenerated | ||
) |
Definition at line 3047 of file heap.c.
References Assert, assign_expr_collations(), check_nested_generated(), COERCE_IMPLICIT_CAST, coerce_to_target_type(), COERCION_ASSIGNMENT, contain_mutable_functions(), 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 3160 of file heap.c.
References BTEqualStrategyNumber, CatalogTupleInsert(), GETSTRUCT, heap_copytuple(), heap_freetuple(), HeapTupleIsValid, sort-test::key, ObjectIdGetDatum, RowExclusiveLock, ScanKeyInit(), StatisticRelidAttnumInhIndexId, systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), and table_open().
Referenced by index_concurrently_swap().
void DeleteAttributeTuples | ( | Oid | relid | ) |
Definition at line 1581 of file heap.c.
References AttributeRelidNumIndexId, 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 1552 of file heap.c.
References CatalogTupleDelete(), elog, ERROR, HeapTupleIsValid, ObjectIdGetDatum, ReleaseSysCache(), RELOID, 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 1618 of file heap.c.
References AttributeRelidNumIndexId, BTEqualStrategyNumber, BTLessEqualStrategyNumber, CatalogTupleDelete(), Int16GetDatum, sort-test::key, ObjectIdGetDatum, RowExclusiveLock, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), HeapTupleData::t_self, table_close(), and table_open().
Referenced by DefineQueryRewrite().
Relation heap_create | ( | const char * | relname, |
Oid | relnamespace, | ||
Oid | reltablespace, | ||
Oid | relid, | ||
Oid | relfilenode, | ||
Oid | accessmtd, | ||
TupleDesc | tupDesc, | ||
char | relkind, | ||
char | relpersistence, | ||
bool | shared_relation, | ||
bool | mapped_relation, | ||
bool | allow_system_table_mods, | ||
TransactionId * | relfrozenxid, | ||
MultiXactId * | relminmxid | ||
) |
Definition at line 294 of file heap.c.
References Assert, ereport, errcode(), errdetail(), errmsg(), ERROR, get_namespace_name(), InvalidMultiXactId, InvalidOid, InvalidTransactionId, IsCatalogNamespace(), IsNormalProcessingMode, IsToastNamespace(), MyDatabaseTableSpace, OidIsValid, RelationData::rd_node, RelationData::rd_rel, recordDependencyOnTablespace(), RelationBuildLocalRelation(), RelationCreateStorage(), RelationOpenSmgr, and table_relation_set_new_filenode().
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 1141 of file heap.c.
References add_exact_object_address(), AddNewAttributeTuples(), AddNewRelationTuple(), AddNewRelationType(), Assert, AssignTypeArrayOid(), binary_upgrade_next_heap_pg_class_oid, binary_upgrade_next_toast_pg_class_oid, 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(), GetNewRelFileNode(), GetSysCacheOid2, heap_create(), InvalidOid, InvokeObjectPostCreateHookArg, IsBinaryUpgrade, IsBootstrapProcessingMode, IsNormalProcessingMode, 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, RowExclusiveLock, StoreConstraints(), table_close(), table_open(), TypeCreate(), and TYPENAMENSP.
Referenced by create_toast_table(), DefineRelation(), and make_new_heap().
void heap_drop_with_catalog | ( | Oid | relid | ) |
Definition at line 1900 of file heap.c.
References AccessExclusiveLock, CacheInvalidateRelcacheByRelid(), CatalogTupleDelete(), CheckTableForSerializableConflictIn(), CheckTableNotInUse(), DeleteAttributeTuples(), DeleteRelationTuple(), elog, ERROR, FOREIGNTABLEREL, get_default_partition_oid(), get_partition_parent(), GETSTRUCT, HeapTupleIsValid, InvalidOid, LockRelationOid(), NoLock, ObjectIdGetDatum, OidIsValid, RelationData::rd_rel, relation_close(), relation_open(), RelationDropStorage(), RelationForgetRelation(), RelationRemoveInheritance(), ReleaseSysCache(), RELOID, 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 3300 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 3385 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 3480 of file heap.c.
References AccessShareLock, BTEqualStrategyNumber, ConstraintOidIndexId, 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 3341 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, | ||
Datum * | attoptions, | ||
CatalogIndexState | indstate | ||
) |
Definition at line 739 of file heap.c.
References BoolGetDatum, CatalogCloseIndexes(), CatalogOpenIndexes(), CatalogTuplesMultiInsertWithInfo(), CharGetDatum, ExecClearTuple(), ExecDropSingleTupleTableSlot(), ExecStoreVirtualTuple(), FormData_pg_attribute, i, Int16GetDatum, Int32GetDatum, InvalidOid, MakeSingleTupleTableSlot(), MAX_CATALOG_MULTI_INSERT_BYTES, Min, NameGetDatum, TupleDescData::natts, ObjectIdGetDatum, palloc(), pfree(), RelationGetDescr, TupleTableSlot::tts_isnull, TupleTableSlot::tts_values, TTSOpsHeapTuple, and TupleDescAttr.
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 920 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 2814 of file heap.c.
References Assert, BTEqualStrategyNumber, CatalogTupleUpdate(), ConstraintRelidTypidNameIndexId, CStringGetDatum, elog, equal(), ereport, errcode(), ERRCODE_DUPLICATE_OBJECT, errmsg(), ERROR, fastgetattr, GETSTRUCT, heap_copytuple(), HeapTupleIsValid, InvalidOid, NOTICE, ObjectIdGetDatum, 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 2072 of file heap.c.
References ATTNUM, 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(), and finish_heap_swap().
|
static |
Definition at line 1519 of file heap.c.
References BTEqualStrategyNumber, CatalogTupleDelete(), HeapTupleIsValid, InheritsRelidSeqnoIndexId, 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 3252 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 RemoveAttrDefault | ( | Oid | relid, |
AttrNumber | attnum, | ||
DropBehavior | behavior, | ||
bool | complain, | ||
bool | internal | ||
) |
Definition at line 1772 of file heap.c.
References AttrDefaultIndexId, BTEqualStrategyNumber, elog, ERROR, GETSTRUCT, HeapTupleIsValid, Int16GetDatum, ObjectAddressStack::object, ObjectIdGetDatum, PERFORM_DELETION_INTERNAL, performDeletion(), RowExclusiveLock, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), and table_open().
Referenced by ATExecAlterColumnType(), ATExecColumnDefault(), ATExecCookedColumnDefault(), and ATExecDropExpression().
void RemoveAttrDefaultById | ( | Oid | attrdefId | ) |
Definition at line 1827 of file heap.c.
References AccessExclusiveLock, ATTNUM, AttrDefaultOidIndexId, BTEqualStrategyNumber, CatalogTupleDelete(), CatalogTupleUpdate(), elog, ERROR, GETSTRUCT, HeapTupleIsValid, Int16GetDatum, NoLock, ObjectIdGetDatum, relation_close(), relation_open(), RowExclusiveLock, ScanKeyInit(), SearchSysCacheCopy2, systable_beginscan(), systable_endscan(), systable_getnext(), HeapTupleData::t_self, table_close(), and table_open().
Referenced by doDeletion().
void RemoveAttributeById | ( | Oid | relid, |
AttrNumber | attnum | ||
) |
Definition at line 1659 of file heap.c.
References AccessExclusiveLock, ATTNUM, BoolGetDatum, CatalogTupleDelete(), CatalogTupleUpdate(), elog, ERROR, GETSTRUCT, heap_modify_tuple(), HeapTupleIsValid, Int16GetDatum, InvalidOid, MemSet, 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 3736 of file heap.c.
References CatalogTupleDelete(), elog, ERROR, HeapTupleIsValid, ObjectIdGetDatum, PARTRELID, 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 3205 of file heap.c.
References BTEqualStrategyNumber, CatalogTupleDelete(), HeapTupleIsValid, Int16GetDatum, sort-test::key, ObjectIdGetDatum, RowExclusiveLock, ScanKeyInit(), StatisticRelidAttnumInhIndexId, systable_beginscan(), systable_endscan(), systable_getnext(), HeapTupleData::t_self, table_close(), and table_open().
Referenced by ATExecAlterColumnType(), heap_drop_with_catalog(), index_drop(), and RemoveAttributeById().
void SetAttrMissing | ( | Oid | relid, |
char * | attname, | ||
char * | value | ||
) |
Definition at line 2140 of file heap.c.
References AccessExclusiveLock, BoolGetDatum, CatalogTupleUpdate(), CStringGetDatum, elog, ERROR, GETSTRUCT, heap_modify_tuple(), HeapTupleIsValid, Int32GetDatum, MemSet, ObjectIdGetDatum, OidFunctionCall3, RelationGetDescr, ReleaseSysCache(), RowExclusiveLock, SearchSysCacheAttName(), HeapTupleData::t_self, table_close(), and table_open().
Referenced by binary_upgrade_set_missing_value().
|
static |
Definition at line 2964 of file heap.c.
References CacheInvalidateRelcache(), CatalogTupleUpdate(), elog, ERROR, GETSTRUCT, heap_freetuple(), HeapTupleIsValid, ObjectIdGetDatum, RelationGetRelid, RELOID, RowExclusiveLock, SearchSysCacheCopy1, HeapTupleData::t_self, table_close(), and table_open().
Referenced by AddRelationNewConstraints(), and StoreConstraints().
Oid StoreAttrDefault | ( | Relation | rel, |
AttrNumber | attnum, | ||
Node * | expr, | ||
bool | is_internal, | ||
bool | add_column_mode | ||
) |
Definition at line 2201 of file heap.c.
References ATTNUM, attnum, AttrDefaultOidIndexId, CatalogTupleInsert(), CatalogTupleUpdate(), ObjectAddress::classId, construct_array(), CreateExecutorState(), CStringGetTextDatum, DatumGetPointer, DEPENDENCY_AUTO, DEPENDENCY_NORMAL, elog, ERROR, ExecEvalExpr(), ExecPrepareExpr(), expression_planner(), FreeExecutorState(), GetNewOidWithIndex(), GetPerTupleExprContext, GETSTRUCT, heap_form_tuple(), heap_freetuple(), heap_modify_tuple(), HeapTupleIsValid, Int16GetDatum, InvokeObjectPostCreateHookArg, MemSet, nodeToString(), ObjectAddress::objectId, ObjectIdGetDatum, ObjectAddress::objectSubId, pfree(), PointerGetDatum, RelationData::rd_att, recordDependencyOn(), recordDependencyOnSingleRelExpr(), RelationGetDescr, RelationGetRelid, RowExclusiveLock, SearchSysCacheCopy2, HeapTupleData::t_self, table_close(), table_open(), TupleDescAttr, and values.
Referenced by AddRelationNewConstraints(), ATExecAlterColumnType(), ATExecCookedColumnDefault(), and StoreConstraints().
Definition at line 2494 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 3767 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, RelationGetDescr, RelationGetPartitionDesc(), RelationGetRelid, RELOID, 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 3608 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, MemSet, 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 2386 of file heap.c.
References CreateConstraintEntry(), ereport, errcode(), errmsg(), ERROR, i, InvalidOid, 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 261 of file heap.c.
References FormData_pg_attribute, 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 249 of file heap.c.
References elog, ERROR, FormData_pg_attribute, 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 151 of file heap.c.
Referenced by aclitem_eq(), aclitemComparator(), check_in_colors_match(), check_out_colors_match(), cmpaffix(), deccall2(), deccall3(), evalLazyFunc(), inet_merge(), inet_same_family(), int4gcd_internal(), int8gcd_internal(), macaddr8_cmp(), macaddr8_eq(),