PostgreSQL Source Code git master
|
#include "postgres.h"
#include "access/htup_details.h"
#include "access/toast_compression.h"
#include "access/tupdesc_details.h"
#include "catalog/pg_collation.h"
#include "catalog/pg_type.h"
#include "common/hashfn.h"
#include "utils/builtins.h"
#include "utils/datum.h"
#include "utils/resowner.h"
#include "utils/syscache.h"
Go to the source code of this file.
Variables | |
static const ResourceOwnerDesc | tupdesc_resowner_desc |
TupleDesc BuildDescFromLists | ( | const List * | names, |
const List * | types, | ||
const List * | typmods, | ||
const List * | collations | ||
) |
Definition at line 1007 of file tupdesc.c.
References Assert, attname, attnum, CreateTemplateTupleDesc(), forfour, lfirst, lfirst_int, lfirst_oid, list_length(), strVal, TupleDescInitEntry(), TupleDescInitEntryCollation(), and types.
Referenced by ExecInitFunctionScan(), ExecInitTableFuncScan(), and inline_set_returning_function().
TupleDesc CreateTemplateTupleDesc | ( | int | natts | ) |
Definition at line 164 of file tupdesc.c.
References Assert, TupleDescData::constr, FormData_pg_attribute, TupleDescData::natts, palloc(), TupleDescData::tdrefcount, TupleDescData::tdtypeid, and TupleDescData::tdtypmod.
Referenced by aclexplode(), addRangeTableEntryForFunction(), AllocateRelationDesc(), brtuple_disk_tupdesc(), build_function_result_tupdesc_d(), build_row_from_vars(), BuildDescForRelation(), BuildDescFromLists(), BuildHardcodedDescriptor(), ConstructTupleDescriptor(), create_toast_table(), CreateReplicationSlot(), CreateTupleDesc(), CreateTupleDescCopy(), CreateTupleDescCopyConstr(), CreateTupleDescTruncatedCopy(), dblink_get_pkey(), ExecInitFunctionScan(), ExecMakeTableFunctionResult(), ExecTypeFromExprList(), ExecTypeFromTLInternal(), expandRecordVariable(), ExplainResultDesc(), formrdesc(), get_expr_result_type(), GetPGVariableResultDesc(), gistrescan(), IdentifySystem(), init_sexpr(), initGinState(), injection_points_stats_fixed(), libpqrcv_processTuples(), load_relcache_init_file(), materializeResult(), ordered_set_startup(), pg_buffercache_pages(), pg_get_publication_tables(), pg_get_sequence_data(), pg_lock_status(), pg_prepared_xact(), pg_stat_file(), pg_stat_get_archiver(), pg_stat_get_backend_subxact(), pg_stat_get_replication_slot(), pg_stat_get_subscription_stats(), pg_stat_get_wal(), pg_visibility_tupdesc(), pg_walfile_name_offset(), ReadReplicationSlot(), SendTablespaceList(), SendTimeLineHistory(), SendXlogRecPtrResult(), show_all_settings(), ShowAllGUCConfig(), ShowGUCConfigOption(), StartReplication(), test_predtest(), tsvector_unnest(), and TypeGetTupleDesc().
TupleDesc CreateTupleDesc | ( | int | natts, |
Form_pg_attribute * | attrs | ||
) |
Definition at line 211 of file tupdesc.c.
References ATTRIBUTE_FIXED_PART_SIZE, CreateTemplateTupleDesc(), i, populate_compact_attribute(), and TupleDescAttr().
Referenced by AddNewAttributeTuples(), and InsertOneTuple().
Definition at line 234 of file tupdesc.c.
References CreateTemplateTupleDesc(), FormData_pg_attribute, i, TupleDescData::natts, populate_compact_attribute(), TupleDescData::tdtypeid, TupleDescData::tdtypmod, and TupleDescAttr().
Referenced by assign_record_type_typmod(), BuildTupleHashTable(), connectby_text(), connectby_text_serial(), CopyCachedPlan(), crosstab(), crosstab_hash(), database_to_xmlschema_internal(), do_autovacuum(), ExecEvalWholeRowVar(), ExecInitForeignScan(), ExecInitFunctionScan(), ExecInsert(), ExecPrepareTuplestoreResult(), FetchPreparedStatementResultDesc(), fmgr_sql(), get_record_type_from_query(), get_tupdesc_for_join_scan_tuples(), GetAfterTriggersStoreSlot(), getSpGistTupleDesc(), init_sexpr(), InitMaterializedSRF(), make_expanded_record_from_exprecord(), make_expanded_record_from_tupdesc(), materializeResult(), PersistHoldablePortal(), plperl_return_next_internal(), plpgsql_exec_function(), pltcl_func_handler(), PLy_spi_execute_fetch_result(), populate_recordset_worker(), RelationBuildLocalRelation(), RelationNameGetTupleDesc(), RevalidateCachedQuery(), schema_to_xmlschema_internal(), spi_dest_startup(), storeRow(), update_cached_tupdesc(), and UtilityTupleDescriptor().
Definition at line 322 of file tupdesc.c.
References AttrDefault::adbin, AttrMissing::am_present, AttrMissing::am_value, CompactAttribute::attbyval, CompactAttribute::attlen, ConstrCheck::ccbin, ConstrCheck::ccenforced, ConstrCheck::ccname, ConstrCheck::ccnoinherit, ConstrCheck::ccvalid, TupleConstr::check, TupleDescData::constr, CreateTemplateTupleDesc(), datumCopy(), TupleConstr::defval, FormData_pg_attribute, TupleConstr::has_generated_stored, TupleConstr::has_not_null, i, TupleConstr::missing, TupleDescData::natts, TupleConstr::num_check, TupleConstr::num_defval, palloc(), palloc0(), populate_compact_attribute(), pstrdup(), TupleDescData::tdtypeid, TupleDescData::tdtypmod, TupleDescAttr(), and TupleDescCompactAttr().
Referenced by ATGetQueueEntry(), CatalogCacheInitializeCache(), init_tuple_slot(), and lookup_rowtype_tupdesc_copy().
Definition at line 278 of file tupdesc.c.
References Assert, CreateTemplateTupleDesc(), FormData_pg_attribute, i, TupleDescData::natts, populate_compact_attribute(), TupleDescData::tdtypeid, TupleDescData::tdtypmod, and TupleDescAttr().
Referenced by gist_page_items(), index_truncate_tuple(), and initGISTstate().
void DecrTupleDescRefCount | ( | TupleDesc | tupdesc | ) |
Definition at line 553 of file tupdesc.c.
References Assert, CurrentResourceOwner, FreeTupleDesc(), ResourceOwnerForgetTupleDesc(), and TupleDescData::tdrefcount.
Referenced by cache_record_field_properties(), and ExecEvalConvertRowtype().
Definition at line 733 of file tupdesc.c.
References i, NameStr, TupleDescData::natts, TupleDescData::tdtypeid, and TupleDescAttr().
Referenced by acquire_inherited_sample_rows(), ProcedureCreate(), record_type_typmod_compare(), RevalidateCachedQuery(), and shared_record_table_compare().
Definition at line 566 of file tupdesc.c.
References AttrDefault::adbin, AttrDefault::adnum, AttrMissing::am_present, AttrMissing::am_value, CompactAttribute::attbyval, CompactAttribute::attlen, ConstrCheck::ccbin, ConstrCheck::ccenforced, ConstrCheck::ccname, ConstrCheck::ccnoinherit, ConstrCheck::ccvalid, TupleConstr::check, TupleDescData::constr, datumIsEqual(), TupleConstr::defval, TupleConstr::has_generated_stored, TupleConstr::has_not_null, i, TupleConstr::missing, NameStr, TupleDescData::natts, TupleConstr::num_check, TupleConstr::num_defval, TupleDescData::tdtypeid, TupleDescAttr(), and TupleDescCompactAttr().
Referenced by RelationFindReplTupleSeq(), and RelationRebuildRelation().
void FreeTupleDesc | ( | TupleDesc | tupdesc | ) |
Definition at line 478 of file tupdesc.c.
References Assert, attbyval, TupleConstr::check, TupleDescData::constr, DatumGetPointer(), TupleConstr::defval, i, TupleConstr::missing, TupleDescData::natts, TupleConstr::num_check, TupleConstr::num_defval, pfree(), TupleDescData::tdrefcount, and TupleDescAttr().
Referenced by AddNewAttributeTuples(), AtEOXact_RelationCache(), DecrTupleDescRefCount(), ER_mc_callback(), ExecMakeTableFunctionResult(), ExecPrepareTuplestoreResult(), get_record_type_from_query(), get_rel_sync_entry(), InvalidateCompositeTypeCacheEntry(), ordered_set_startup(), PLy_result_dealloc(), RelationDestroyRelation(), ResOwnerReleaseTupleDesc(), RevalidateCachedQuery(), spgendscan(), update_cached_tupdesc(), and walrcv_clear_result().
Definition at line 769 of file tupdesc.c.
References hash_combine(), hash_uint32(), i, TupleDescData::natts, TupleDescData::tdtypeid, and TupleDescAttr().
Referenced by record_type_typmod_hash(), and shared_record_table_hash().
void IncrTupleDescRefCount | ( | TupleDesc | tupdesc | ) |
Definition at line 535 of file tupdesc.c.
References Assert, CurrentResourceOwner, ResourceOwnerEnlarge(), ResourceOwnerRememberTupleDesc(), and TupleDescData::tdrefcount.
Referenced by cache_record_field_properties(), and ExecEvalConvertRowtype().
void populate_compact_attribute | ( | TupleDesc | tupdesc, |
int | attnum | ||
) |
Definition at line 107 of file tupdesc.c.
References attnum, TupleDescData::compact_attrs, populate_compact_attribute_internal(), and TupleDescAttr().
Referenced by BuildDescForRelation(), BuildHardcodedDescriptor(), ConstructTupleDescriptor(), CreateTupleDesc(), CreateTupleDescCopy(), CreateTupleDescCopyConstr(), CreateTupleDescTruncatedCopy(), DefineRelation(), formrdesc(), getSpGistTupleDesc(), load_relcache_init_file(), RelationBuildLocalRelation(), RelationBuildTupleDesc(), TupleDescCopy(), TupleDescCopyEntry(), TupleDescInitBuiltinEntry(), and TupleDescInitEntry().
|
inlinestatic |
Definition at line 64 of file tupdesc.c.
References CompactAttribute::attalignby, CompactAttribute::attbyval, CompactAttribute::attcacheoff, CompactAttribute::attgenerated, CompactAttribute::atthasmissing, CompactAttribute::attisdropped, CompactAttribute::attispackable, CompactAttribute::attlen, CompactAttribute::attnotnull, elog, and ERROR.
Referenced by populate_compact_attribute(), and verify_compact_attribute().
|
inlinestatic |
Definition at line 54 of file tupdesc.c.
References PointerGetDatum(), ResourceOwnerForget(), and tupdesc_resowner_desc.
Referenced by DecrTupleDescRefCount().
|
inlinestatic |
Definition at line 48 of file tupdesc.c.
References PointerGetDatum(), ResourceOwnerRemember(), and tupdesc_resowner_desc.
Referenced by IncrTupleDescRefCount().
|
static |
Definition at line 1083 of file tupdesc.c.
References DatumGetPointer(), psprintf(), res, TupleDescData::tdtypeid, and TupleDescData::tdtypmod.
|
static |
Definition at line 1072 of file tupdesc.c.
References Assert, DatumGetPointer(), FreeTupleDesc(), res, and TupleDescData::tdrefcount.
Definition at line 404 of file tupdesc.c.
References TupleDescData::constr, i, TupleDescData::natts, populate_compact_attribute(), TupleDescData::tdrefcount, TupleDescAttr(), and TupleDescSize.
Referenced by share_tupledesc().
void TupleDescCopyEntry | ( | TupleDesc | dst, |
AttrNumber | dstAttno, | ||
TupleDesc | src, | ||
AttrNumber | srcAttno | ||
) |
Definition at line 444 of file tupdesc.c.
References Assert, ATTRIBUTE_FIXED_PART_SIZE, PointerIsValid, populate_compact_attribute(), and TupleDescAttr().
Referenced by addRangeTableEntryForFunction(), ExecInitFunctionScan(), and ordered_set_startup().
Node * TupleDescGetDefault | ( | TupleDesc | tupdesc, |
AttrNumber | attnum | ||
) |
Definition at line 1048 of file tupdesc.c.
References attnum, TupleDescData::constr, TupleConstr::defval, i, TupleConstr::num_defval, and stringToNode().
Referenced by build_column_default(), expandTableLikeClause(), and MergeAttributes().
void TupleDescInitBuiltinEntry | ( | TupleDesc | desc, |
AttrNumber | attributeNumber, | ||
const char * | attributeName, | ||
Oid | oidtypeid, | ||
int32 | typmod, | ||
int | attdim | ||
) |
Definition at line 874 of file tupdesc.c.
References Assert, elog, ERROR, FLOAT8PASSBYVAL, InvalidCompressionMethod, InvalidOid, namestrcpy(), PG_INT16_MAX, PointerIsValid, populate_compact_attribute(), and TupleDescAttr().
Referenced by CreateReplicationSlot(), IdentifySystem(), ReadReplicationSlot(), SendTablespaceList(), SendTimeLineHistory(), SendXlogRecPtrResult(), ShowAllGUCConfig(), ShowGUCConfigOption(), and StartReplication().
void TupleDescInitEntry | ( | TupleDesc | desc, |
AttrNumber | attributeNumber, | ||
const char * | attributeName, | ||
Oid | oidtypeid, | ||
int32 | typmod, | ||
int | attdim | ||
) |
Definition at line 798 of file tupdesc.c.
References Assert, elog, ERROR, GETSTRUCT, HeapTupleIsValid, InvalidCompressionMethod, MemSet, NAMEDATALEN, NameStr, namestrcpy(), ObjectIdGetDatum(), PG_INT16_MAX, PointerIsValid, populate_compact_attribute(), ReleaseSysCache(), SearchSysCache1(), and TupleDescAttr().
Referenced by aclexplode(), addRangeTableEntryForFunction(), brtuple_disk_tupdesc(), build_function_result_tupdesc_d(), build_row_from_vars(), BuildDescForRelation(), BuildDescFromLists(), CallStmtResultDesc(), create_toast_table(), dblink_get_pkey(), ExecInitFunctionScan(), ExecMakeTableFunctionResult(), ExecTypeFromExprList(), ExecTypeFromTLInternal(), expandRecordVariable(), ExplainResultDesc(), get_expr_result_type(), GetPGVariableResultDesc(), gistrescan(), init_sexpr(), initGinState(), injection_points_stats_fixed(), libpqrcv_processTuples(), materializeResult(), ordered_set_startup(), pg_buffercache_pages(), pg_get_publication_tables(), pg_get_sequence_data(), pg_lock_status(), pg_prepared_xact(), pg_stat_file(), pg_stat_get_archiver(), pg_stat_get_backend_subxact(), pg_stat_get_replication_slot(), pg_stat_get_subscription_stats(), pg_stat_get_wal(), pg_visibility_tupdesc(), pg_walfile_name_offset(), resolve_polymorphic_tupdesc(), show_all_settings(), test_predtest(), tsvector_unnest(), and TypeGetTupleDesc().
void TupleDescInitEntryCollation | ( | TupleDesc | desc, |
AttrNumber | attributeNumber, | ||
Oid | collationid | ||
) |
Definition at line 982 of file tupdesc.c.
References Assert, PointerIsValid, and TupleDescAttr().
Referenced by addRangeTableEntryForFunction(), build_row_from_vars(), BuildDescForRelation(), BuildDescFromLists(), ExecInitFunctionScan(), ExecTypeFromExprList(), ExecTypeFromTLInternal(), expandRecordVariable(), get_expr_result_type(), initGinState(), and resolve_polymorphic_tupdesc().
void verify_compact_attribute | ( | TupleDesc | tupdesc, |
int | attnum | ||
) |
Definition at line 132 of file tupdesc.c.
References Assert, CompactAttribute::attcacheoff, attnum, TupleDescData::compact_attrs, populate_compact_attribute_internal(), and TupleDescAttr().
Referenced by TupleDescCompactAttr().
|
static |
Definition at line 37 of file tupdesc.c.
Referenced by ResourceOwnerForgetTupleDesc(), and ResourceOwnerRememberTupleDesc().