PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/htup_details.h"
#include "access/relation.h"
#include "catalog/namespace.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_type.h"
#include "funcapi.h"
#include "miscadmin.h"
#include "nodes/nodeFuncs.h"
#include "utils/array.h"
#include "utils/builtins.h"
#include "utils/lsyscache.h"
#include "utils/memutils.h"
#include "utils/regproc.h"
#include "utils/rel.h"
#include "utils/syscache.h"
#include "utils/tuplestore.h"
#include "utils/typcache.h"
Go to the source code of this file.
Data Structures | |
struct | polymorphic_actuals |
Typedefs | |
typedef struct polymorphic_actuals | polymorphic_actuals |
typedef struct polymorphic_actuals polymorphic_actuals |
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().
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(), jsonb_build_object(), and stats_fill_fcinfo_from_arg_pairs().
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_logical_snapshot_info(), pg_get_logical_snapshot_meta(), 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().
|
static |
Definition at line 1328 of file funcapi.c.
References get_typtype(), getBaseType(), TYPEFUNC_COMPOSITE, TYPEFUNC_COMPOSITE_DOMAIN, TYPEFUNC_OTHER, TYPEFUNC_RECORD, and TYPEFUNC_SCALAR.
Referenced by get_expr_result_type(), internal_get_result_type(), and TypeGetTupleDesc().
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().
|
static |
Definition at line 430 of file funcapi.c.
References assign_record_type_typmod(), build_function_result_tupdesc_t(), elog, ereport, errcode(), errmsg(), ERROR, ReturnSetInfo::expectedDesc, exprType(), format_type_be(), get_type_func_class(), GETSTRUCT, HeapTupleIsValid, InvalidOid, IsA, lookup_rowtype_tupdesc_copy(), NameStr, ObjectIdGetDatum(), ReleaseSysCache(), resolve_polymorphic_tupdesc(), SearchSysCache1(), TupleDescData::tdtypeid, TupleDescData::tdtypmod, TYPEFUNC_COMPOSITE, TYPEFUNC_COMPOSITE_DOMAIN, TYPEFUNC_RECORD, and TYPEFUNC_SCALAR.
Referenced by get_call_result_type(), get_expr_result_type(), and get_func_result_type().
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().
|
static |
Definition at line 655 of file funcapi.c.
References polymorphic_actuals::anyarray_type, polymorphic_actuals::anyelement_type, elog, ereport, errcode(), errmsg(), ERROR, format_type_be(), get_array_type(), OidIsValid, and resolve_anyelement_from_others().
Referenced by resolve_polymorphic_argtypes(), and resolve_polymorphic_tupdesc().
|
static |
Definition at line 589 of file funcapi.c.
References polymorphic_actuals::anyarray_type, polymorphic_actuals::anyelement_type, polymorphic_actuals::anymultirange_type, polymorphic_actuals::anyrange_type, elog, ereport, errcode(), errmsg(), ERROR, format_type_be(), get_element_type(), get_multirange_range(), get_range_subtype(), getBaseType(), and OidIsValid.
Referenced by resolve_anyarray_from_others(), resolve_polymorphic_argtypes(), and resolve_polymorphic_tupdesc().
|
static |
Definition at line 710 of file funcapi.c.
References polymorphic_actuals::anymultirange_type, polymorphic_actuals::anyrange_type, elog, ereport, errcode(), errmsg(), ERROR, format_type_be(), get_range_multirange(), getBaseType(), and OidIsValid.
Referenced by resolve_polymorphic_argtypes(), and resolve_polymorphic_tupdesc().
|
static |
Definition at line 681 of file funcapi.c.
References polymorphic_actuals::anymultirange_type, polymorphic_actuals::anyrange_type, elog, ereport, errcode(), errmsg(), ERROR, format_type_be(), get_multirange_range(), getBaseType(), and OidIsValid.
Referenced by resolve_polymorphic_argtypes(), and resolve_polymorphic_tupdesc().
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().
|
static |
Definition at line 744 of file funcapi.c.
References polymorphic_actuals::anyarray_type, polymorphic_actuals::anyelement_type, polymorphic_actuals::anymultirange_type, polymorphic_actuals::anyrange_type, oidvector::dim1, exprInputCollation(), get_call_expr_argtype(), get_typcollation(), i, InvalidOid, NameStr, TupleDescData::natts, OidIsValid, resolve_anyarray_from_others(), resolve_anyelement_from_others(), resolve_anymultirange_from_others(), resolve_anyrange_from_others(), TupleDescAttr, TupleDescInitEntry(), TupleDescInitEntryCollation(), and oidvector::values.
Referenced by internal_get_result_type().
|
static |
Definition at line 238 of file funcapi.c.
References arg, DatumGetPointer(), FmgrInfo::fn_extra, MemoryContextDelete(), and FuncCallContext::multi_call_memory_ctx.
Referenced by end_MultiFuncCall(), and init_MultiFuncCall().
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.