PostgreSQL Source Code
git master
|
#include "access/tupdesc.h"
#include "executor/executor.h"
#include "executor/tuptable.h"
#include "fmgr.h"
Go to the source code of this file.
Data Structures | |
struct | AttInMetadata |
struct | FuncCallContext |
Macros | |
#define | TupleGetDatum(_slot, _tuple) HeapTupleGetDatum(_tuple) |
#define | MAT_SRF_USE_EXPECTED_DESC 0x01 /* use expectedDesc as tupdesc. */ |
#define | MAT_SRF_BLESS |
#define | SRF_IS_FIRSTCALL() (fcinfo->flinfo->fn_extra == NULL) |
#define | SRF_FIRSTCALL_INIT() init_MultiFuncCall(fcinfo) |
#define | SRF_PERCALL_SETUP() per_MultiFuncCall(fcinfo) |
#define | SRF_RETURN_NEXT(_funcctx, _result) |
#define | SRF_RETURN_NEXT_NULL(_funcctx) |
#define | SRF_RETURN_DONE(_funcctx) |
Typedefs | |
typedef struct AttInMetadata | AttInMetadata |
typedef struct FuncCallContext | FuncCallContext |
typedef enum TypeFuncClass | TypeFuncClass |
Enumerations | |
enum | TypeFuncClass { TYPEFUNC_SCALAR , TYPEFUNC_COMPOSITE , TYPEFUNC_COMPOSITE_DOMAIN , TYPEFUNC_RECORD , TYPEFUNC_OTHER } |
#define MAT_SRF_BLESS |
#define MAT_SRF_USE_EXPECTED_DESC 0x01 /* use expectedDesc as tupdesc. */ |
#define SRF_FIRSTCALL_INIT | ( | ) | init_MultiFuncCall(fcinfo) |
#define SRF_IS_FIRSTCALL | ( | ) | (fcinfo->flinfo->fn_extra == NULL) |
#define SRF_PERCALL_SETUP | ( | ) | per_MultiFuncCall(fcinfo) |
#define SRF_RETURN_DONE | ( | _funcctx | ) |
#define SRF_RETURN_NEXT | ( | _funcctx, | |
_result | |||
) |
#define SRF_RETURN_NEXT_NULL | ( | _funcctx | ) |
#define TupleGetDatum | ( | _slot, | |
_tuple | |||
) | HeapTupleGetDatum(_tuple) |
typedef struct AttInMetadata AttInMetadata |
typedef struct FuncCallContext FuncCallContext |
typedef enum TypeFuncClass TypeFuncClass |
enum TypeFuncClass |
Definition at line 2158 of file execTuples.c.
References assign_record_type_typmod(), TupleDescData::tdtypeid, and TupleDescData::tdtypmod.
Referenced by aclexplode(), brin_metapage_info(), bt_page_items_bytea(), bt_page_items_internal(), exec_eval_datum(), ExecEvalWholeRowVar(), ExecInitExprRec(), ExecInitFunctionScan(), get_expr_result_type(), hash_bitmap_info(), hash_metapage_info(), hash_page_items(), hash_page_stats(), init_sql_fcache(), InitMaterializedSRF(), injection_points_stats_fixed(), pg_buffercache_pages(), pg_get_catalog_foreign_keys(), 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_stats_ext_mcvlist_items(), pg_visibility_tupdesc(), pg_walfile_name_offset(), pgstathashindex(), PLy_output_setup_record(), setup_firstcall(), ssl_extension_info(), test_enc_conversion(), test_predtest(), and TupleDescGetAttInMetadata().
TupleDesc build_function_result_tupdesc_d | ( | char | prokind, |
Datum | proallargtypes, | ||
Datum | proargmodes, | ||
Datum | proargnames | ||
) |
Definition at line 1751 of file funcapi.c.
References ARR_DATA_PTR, ARR_DIMS, ARR_ELEMTYPE, ARR_HASNULL, ARR_NDIM, Assert, CreateTemplateTupleDesc(), DatumGetArrayTypeP, deconstruct_array_builtin(), elog, ERROR, i, palloc(), PointerGetDatum(), psprintf(), TextDatumGetCString, and TupleDescInitEntry().
Referenced by build_function_result_tupdesc_t(), and ProcedureCreate().
Definition at line 1705 of file funcapi.c.
References build_function_result_tupdesc_d(), GETSTRUCT, heap_attisnull(), PointerGetDatum(), SysCacheGetAttr(), and SysCacheGetAttrNotNull().
Referenced by CallStmtResultDesc(), internal_get_result_type(), and ProcedureCreate().
HeapTuple BuildTupleFromCStrings | ( | AttInMetadata * | attinmeta, |
char ** | values | ||
) |
Definition at line 2222 of file execTuples.c.
References AttInMetadata::attinfuncs, AttInMetadata::attioparams, AttInMetadata::atttypmods, heap_form_tuple(), i, InputFunctionCall(), TupleDescData::natts, palloc(), pfree(), AttInMetadata::tupdesc, TupleDescAttr, and values.
Referenced by bt_metap(), bt_multi_page_stats(), bt_page_stats_internal(), build_pgstattuple_type(), build_tuplestore_recursively(), crosstab(), dblink_get_pkey(), get_crosstab_tuplestore(), libpqrcv_processTuples(), materializeResult(), pg_get_keywords(), pg_get_multixact_members(), pgp_armor_headers(), pgrowlocks(), pgstatindex_impl(), pltcl_build_tuple_result(), prs_process_call(), show_all_settings(), storeRow(), ts_process_call(), tt_process_call(), and xpath_table().
void end_MultiFuncCall | ( | PG_FUNCTION_ARGS | , |
FuncCallContext * | funcctx | ||
) |
Definition at line 220 of file funcapi.c.
References ReturnSetInfo::econtext, PointerGetDatum(), shutdown_MultiFuncCall(), and UnregisterExprContextCallback().
int extract_variadic_args | ( | FunctionCallInfo | fcinfo, |
int | variadic_start, | ||
bool | convert_unknown, | ||
Datum ** | args, | ||
Oid ** | types, | ||
bool ** | nulls | ||
) |
Definition at line 2005 of file funcapi.c.
References generate_unaccent_rules::args, ARR_ELEMTYPE, array_in(), Assert, CStringGetTextDatum, deconstruct_array(), ereport, errcode(), errmsg(), ERROR, FunctionCallInfoBaseData::flinfo, get_fn_expr_arg_stable(), get_fn_expr_argtype(), get_fn_expr_variadic(), get_typlenbyvalalign(), i, OidIsValid, palloc0(), PG_ARGISNULL, PG_GETARG_ARRAYTYPE_P, PG_GETARG_DATUM, PG_GETARG_POINTER, PG_NARGS, typalign, and types.
Referenced by json_build_array(), json_build_object(), jsonb_build_array(), and jsonb_build_object().
TypeFuncClass get_call_result_type | ( | FunctionCallInfo | fcinfo, |
Oid * | resultTypeId, | ||
TupleDesc * | resultTupleDesc | ||
) |
Definition at line 276 of file funcapi.c.
References FunctionCallInfoBaseData::flinfo, FmgrInfo::fn_expr, FmgrInfo::fn_oid, internal_get_result_type(), and FunctionCallInfoBaseData::resultinfo.
Referenced by brin_metapage_info(), bt_metap(), bt_multi_page_stats(), bt_page_items_bytea(), bt_page_items_internal(), bt_page_stats_internal(), build_pgstattuple_type(), copy_replication_slot(), crosstab(), get_record_type_from_query(), gin_leafpage_items(), gin_metapage_info(), gin_page_opaque_info(), gist_page_opaque_info(), hash_bitmap_info(), hash_metapage_info(), hash_page_items(), hash_page_stats(), heap_page_items(), heap_tuple_infomask_flags(), init_sql_fcache(), InitMaterializedSRF(), materializeResult(), page_header(), pg_backup_stop(), pg_buffercache_pages(), pg_buffercache_summary(), pg_control_checkpoint(), pg_control_init(), pg_control_recovery(), pg_control_system(), pg_create_logical_replication_slot(), pg_create_physical_replication_slot(), pg_get_catalog_foreign_keys(), pg_get_keywords(), pg_get_multixact_members(), pg_get_object_address(), pg_get_wal_record_info(), pg_get_wal_summarizer_state(), pg_identify_object(), pg_identify_object_as_address(), pg_input_error_info(), pg_last_committed_xact(), pg_partition_tree(), pg_replication_slot_advance(), pg_sequence_parameters(), pg_split_walfile_name(), pg_stat_get_wal_receiver(), pg_stat_statements_info(), pg_stats_ext_mcvlist_items(), pg_timezone_abbrevs(), pg_visibility_map_summary(), pg_xact_commit_timestamp_origin(), pgp_armor_headers(), pgstatginindex_internal(), pgstathashindex(), pgstatindex_impl(), pgstattuple_approx_internal(), plperl_return_next_internal(), plperl_sv_to_datum(), plpgsql_exec_function(), pltcl_func_handler(), PLy_exec_function(), prs_setup_firstcall(), setup_firstcall(), ssl_extension_info(), storeRow(), test_enc_conversion(), ts_setup_firstcall(), tsvector_unnest(), and tt_setup_firstcall().
Definition at line 551 of file funcapi.c.
References ereport, errcode(), errmsg(), ERROR, exprType(), format_type_be(), get_expr_result_type(), TYPEFUNC_COMPOSITE, and TYPEFUNC_COMPOSITE_DOMAIN.
Referenced by expandRecordVariable(), ExpandRowReference(), get_name_for_var_field(), get_rte_attribute_is_dropped(), ParseComplexProjection(), and process_function_rte_ref().
TypeFuncClass get_expr_result_type | ( | Node * | expr, |
Oid * | resultTypeId, | ||
TupleDesc * | resultTupleDesc | ||
) |
Definition at line 299 of file funcapi.c.
References RowExpr::args, Assert, BlessTupleDesc(), CreateTemplateTupleDesc(), DatumGetHeapTupleHeader, exprCollation(), exprType(), exprTypmod(), forboth, get_opcode(), get_type_func_class(), HeapTupleHeaderGetTypeId, HeapTupleHeaderGetTypMod, i, internal_get_result_type(), IsA, lfirst, list_length(), lookup_rowtype_tupdesc_copy(), strVal, TupleDescInitEntry(), TupleDescInitEntryCollation(), TYPEFUNC_COMPOSITE, TYPEFUNC_COMPOSITE_DOMAIN, and TYPEFUNC_RECORD.
Referenced by addRangeTableEntryForFunction(), ExecInitFunctionScan(), expandRTE(), get_expr_result_tupdesc(), init_sexpr(), inline_function(), inline_set_returning_function(), and pull_up_constant_function().
int get_func_arg_info | ( | HeapTuple | procTup, |
Oid ** | p_argtypes, | ||
char *** | p_argnames, | ||
char ** | p_argmodes | ||
) |
Definition at line 1379 of file funcapi.c.
References ARR_DATA_PTR, ARR_DIMS, ARR_ELEMTYPE, ARR_HASNULL, ARR_NDIM, Assert, DatumGetArrayTypeP, deconstruct_array_builtin(), elog, ERROR, GETSTRUCT, i, palloc(), SysCacheGetAttr(), and TextDatumGetCString.
Referenced by do_compile(), make_callstmt_target(), MatchNamedCall(), pg_get_function_arg_default(), plperl_validator(), plpgsql_validator(), plsample_func_handler(), PLy_procedure_create(), print_function_arguments(), and print_function_sqlbody().
Definition at line 1522 of file funcapi.c.
References ARR_DATA_PTR, ARR_DIMS, ARR_ELEMTYPE, ARR_HASNULL, ARR_NDIM, DatumGetArrayTypeP, deconstruct_array_builtin(), elog, ERROR, i, palloc(), PointerGetDatum(), and TextDatumGetCString.
Referenced by prepare_sql_fn_parse_info(), and ProcedureCreate().
char* get_func_result_name | ( | Oid | functionId | ) |
Definition at line 1607 of file funcapi.c.
References ARR_DATA_PTR, ARR_DIMS, ARR_ELEMTYPE, ARR_HASNULL, ARR_NDIM, Assert, DatumGetArrayTypeP, deconstruct_array_builtin(), elog, ERROR, heap_attisnull(), HeapTupleIsValid, i, ObjectIdGetDatum(), ReleaseSysCache(), SearchSysCache1(), SysCacheGetAttrNotNull(), and TextDatumGetCString.
Referenced by chooseScalarFunctionAlias().
TypeFuncClass get_func_result_type | ( | Oid | functionId, |
Oid * | resultTypeId, | ||
TupleDesc * | resultTupleDesc | ||
) |
Definition at line 410 of file funcapi.c.
References internal_get_result_type().
Referenced by fmgr_sql_validator().
Definition at line 1475 of file funcapi.c.
References ARR_DATA_PTR, ARR_DIMS, ARR_ELEMTYPE, ARR_HASNULL, ARR_NDIM, DatumGetArrayTypeP, elog, ERROR, palloc(), and SysCacheGetAttr().
Referenced by print_function_trftypes().
|
inlinestatic |
Definition at line 230 of file funcapi.h.
References HeapTupleHeaderGetDatum(), and HeapTupleData::t_data.
Referenced by aclexplode(), brin_metapage_info(), bt_metap(), bt_multi_page_stats(), bt_page_print_tuples(), bt_page_stats_internal(), build_pgstattuple_type(), copy_replication_slot(), dblink_get_pkey(), exec_eval_datum(), ExecEvalConvertRowtype(), ExecEvalFieldStoreForm(), ExecEvalRow(), gin_leafpage_items(), gin_metapage_info(), gin_page_opaque_info(), gist_page_opaque_info(), hash_bitmap_info(), hash_metapage_info(), hash_page_items(), hash_page_stats(), heap_page_items(), heap_tuple_infomask_flags(), hstore_each(), hstore_populate_record(), injection_points_stats_fixed(), page_header(), pg_backup_stop(), pg_buffercache_pages(), pg_buffercache_summary(), pg_control_checkpoint(), pg_control_init(), pg_control_recovery(), pg_control_system(), pg_create_logical_replication_slot(), pg_create_physical_replication_slot(), pg_get_catalog_foreign_keys(), pg_get_keywords(), pg_get_multixact_members(), pg_get_object_address(), pg_get_publication_tables(), pg_get_sequence_data(), pg_get_wal_record_info(), pg_get_wal_summarizer_state(), pg_identify_object(), pg_identify_object_as_address(), pg_input_error_info(), pg_last_committed_xact(), pg_lock_status(), pg_partition_tree(), pg_prepared_xact(), pg_replication_slot_advance(), pg_sequence_parameters(), pg_split_walfile_name(), 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_stat_get_wal_receiver(), pg_stat_statements_info(), pg_stats_ext_mcvlist_items(), pg_timezone_abbrevs(), pg_visibility(), pg_visibility_map(), pg_visibility_map_rel(), pg_visibility_map_summary(), pg_visibility_rel(), pg_walfile_name_offset(), pg_xact_commit_timestamp_origin(), pgp_armor_headers(), pgstatginindex_internal(), pgstathashindex(), pgstatindex_impl(), pgstattuple_approx_internal(), plperl_hash_to_datum(), plperl_return_next_internal(), pltcl_build_tuple_result(), pltcl_func_handler(), prs_process_call(), show_all_settings(), ssl_extension_info(), test_enc_conversion(), test_predtest(), ts_process_call(), tsvector_unnest(), and tt_process_call().
Datum HeapTupleHeaderGetDatum | ( | HeapTupleHeader | tuple | ) |
Definition at line 2311 of file execTuples.c.
References HeapTupleHeaderGetDatumLength, HeapTupleHeaderGetTypeId, HeapTupleHeaderGetTypMod, HeapTupleHeaderHasExternal, lookup_rowtype_tupdesc(), PointerGetDatum(), ReleaseTupleDesc, and toast_flatten_tuple_to_datum().
Referenced by HeapTupleGetDatum(), populate_composite(), and populate_recordset_record().
FuncCallContext* init_MultiFuncCall | ( | PG_FUNCTION_ARGS | ) |
Definition at line 133 of file funcapi.c.
References ALLOCSET_SMALL_SIZES, AllocSetContextCreate, FuncCallContext::attinmeta, FuncCallContext::call_cntr, ReturnSetInfo::econtext, elog, ereport, errcode(), errmsg(), ERROR, IsA, FuncCallContext::max_calls, MemoryContextAllocZero(), FuncCallContext::multi_call_memory_ctx, PointerGetDatum(), RegisterExprContextCallback(), shutdown_MultiFuncCall(), FuncCallContext::tuple_desc, and FuncCallContext::user_fctx.
void InitMaterializedSRF | ( | FunctionCallInfo | fcinfo, |
bits32 | flags | ||
) |
Definition at line 76 of file funcapi.c.
References ReturnSetInfo::allowedModes, BlessTupleDesc(), CreateTupleDescCopy(), ReturnSetInfo::econtext, ExprContext::ecxt_per_query_memory, elog, ereport, errcode(), errmsg(), ERROR, ReturnSetInfo::expectedDesc, get_call_result_type(), if(), IsA, MAT_SRF_BLESS, MAT_SRF_USE_EXPECTED_DESC, MemoryContextSwitchTo(), FunctionCallInfoBaseData::resultinfo, ReturnSetInfo::returnMode, ReturnSetInfo::setDesc, ReturnSetInfo::setResult, SFRM_Materialize, SFRM_Materialize_Random, tuplestore_begin_heap(), TYPEFUNC_COMPOSITE, and work_mem.
Referenced by brin_page_items(), dblink_get_notify(), each_worker(), each_worker_jsonb(), elements_worker(), elements_worker_jsonb(), get_altertable_subcmdinfo(), GetWALRecordsInfo(), gist_page_items(), gist_page_items_bytea(), pg_available_extension_versions(), pg_available_extensions(), pg_available_wal_summaries(), pg_config(), pg_cursor(), pg_event_trigger_ddl_commands(), pg_event_trigger_dropped_objects(), pg_extension_update_paths(), pg_get_backend_memory_contexts(), pg_get_replication_slots(), pg_get_shmem_allocations(), pg_get_wait_events(), pg_get_wal_block_info(), pg_hba_file_rules(), pg_ident_file_mappings(), pg_logical_slot_get_changes_guts(), pg_ls_dir(), pg_ls_dir_files(), pg_prepared_statement(), pg_show_replication_origin_status(), pg_stat_get_activity(), pg_stat_get_io(), pg_stat_get_progress_info(), pg_stat_get_recovery_prefetch(), pg_stat_get_slru(), pg_stat_get_subscription(), pg_stat_get_wal_senders(), pg_stat_statements_internal(), pg_tablespace_databases(), pg_wal_summary_contents(), pgrowlocks(), postgres_fdw_get_connections_internal(), show_all_file_settings(), text_to_table(), verify_heapam(), and xpath_table().
FuncCallContext* per_MultiFuncCall | ( | PG_FUNCTION_ARGS | ) |
TupleDesc RelationNameGetTupleDesc | ( | const char * | relname | ) |
Definition at line 1870 of file funcapi.c.
References AccessShareLock, CreateTupleDescCopy(), makeRangeVarFromNameList(), relation_close(), relation_openrv(), RelationGetDescr, relname, and stringToQualifiedNameList().
bool resolve_polymorphic_argtypes | ( | int | numargs, |
Oid * | argtypes, | ||
char * | argmodes, | ||
Node * | call_expr | ||
) |
Definition at line 1064 of file funcapi.c.
References polymorphic_actuals::anyarray_type, polymorphic_actuals::anyelement_type, polymorphic_actuals::anymultirange_type, polymorphic_actuals::anyrange_type, get_call_expr_argtype(), i, OidIsValid, resolve_anyarray_from_others(), resolve_anyelement_from_others(), resolve_anymultirange_from_others(), and resolve_anyrange_from_others().
Referenced by plpgsql_resolve_polymorphic_argtypes().
AttInMetadata* TupleDescGetAttInMetadata | ( | TupleDesc | tupdesc | ) |
Definition at line 2173 of file execTuples.c.
References AttInMetadata::attinfuncs, AttInMetadata::attioparams, AttInMetadata::atttypmods, BlessTupleDesc(), fmgr_info(), getTypeInputInfo(), i, TupleDescData::natts, palloc(), palloc0(), AttInMetadata::tupdesc, and TupleDescAttr.
Referenced by bt_metap(), bt_multi_page_stats(), bt_page_stats_internal(), build_pgstattuple_type(), connectby_text(), connectby_text_serial(), create_foreign_modify(), crosstab(), dblink_get_pkey(), get_crosstab_tuplestore(), hash_page_items(), libpqrcv_processTuples(), materializeResult(), pg_get_keywords(), pg_get_multixact_members(), pg_stats_ext_mcvlist_items(), pgp_armor_headers(), pgrowlocks(), pgstatindex_impl(), pltcl_build_tuple_result(), pltcl_func_handler(), pltcl_init_tuple_store(), postgresAcquireSampleRowsFunc(), postgresBeginDirectModify(), postgresBeginForeignScan(), prs_setup_firstcall(), show_all_settings(), storeRow(), ts_setup_firstcall(), tt_setup_firstcall(), and xpath_table().
Definition at line 1903 of file funcapi.c.
References attname, CreateTemplateTupleDesc(), elog, ereport, errcode(), errmsg(), ERROR, get_type_func_class(), label, linitial, list_length(), list_nth(), lookup_rowtype_tupdesc_copy(), namestrcpy(), TupleDescData::natts, NIL, strVal, TupleDescData::tdtypeid, TupleDescData::tdtypmod, TupleDescAttr, TupleDescInitEntry(), TYPEFUNC_COMPOSITE, TYPEFUNC_RECORD, and TYPEFUNC_SCALAR.