PostgreSQL Source Code
git master
|
#include "access/xact.h"
#include "commands/event_trigger.h"
#include "commands/trigger.h"
#include "executor/spi.h"
#include "utils/expandedrecord.h"
#include "utils/typcache.h"
Go to the source code of this file.
Macros | |
#define | TEXTDOMAIN PG_TEXTDOMAIN("plpgsql") |
#define | _(x) dgettext(TEXTDOMAIN, x) |
#define | PLPGSQL_XCHECK_NONE 0 |
#define | PLPGSQL_XCHECK_SHADOWVAR (1 << 1) |
#define | PLPGSQL_XCHECK_TOOMANYROWS (1 << 2) |
#define | PLPGSQL_XCHECK_STRICTMULTIASSIGNMENT (1 << 3) |
#define | PLPGSQL_XCHECK_ALL ((int) ~0) |
#define TEXTDOMAIN PG_TEXTDOMAIN("plpgsql") |
typedef struct PLpgSQL_case_when PLpgSQL_case_when |
typedef struct PLpgSQL_condition PLpgSQL_condition |
typedef struct PLpgSQL_datum PLpgSQL_datum |
typedef enum PLpgSQL_datum_type PLpgSQL_datum_type |
typedef struct PLpgSQL_diag_item PLpgSQL_diag_item |
typedef struct PLpgSQL_exception PLpgSQL_exception |
typedef struct PLpgSQL_exception_block PLpgSQL_exception_block |
typedef struct PLpgSQL_execstate PLpgSQL_execstate |
typedef struct PLpgSQL_expr PLpgSQL_expr |
typedef struct PLpgSQL_func_hashkey PLpgSQL_func_hashkey |
typedef struct PLpgSQL_function PLpgSQL_function |
typedef enum PLpgSQL_getdiag_kind PLpgSQL_getdiag_kind |
typedef struct PLpgSQL_if_elsif PLpgSQL_if_elsif |
typedef enum PLpgSQL_label_type PLpgSQL_label_type |
typedef struct PLpgSQL_nsitem PLpgSQL_nsitem |
typedef enum PLpgSQL_nsitem_type PLpgSQL_nsitem_type |
typedef struct PLpgSQL_plugin PLpgSQL_plugin |
typedef enum PLpgSQL_promise_type PLpgSQL_promise_type |
typedef struct PLpgSQL_raise_option PLpgSQL_raise_option |
typedef enum PLpgSQL_raise_option_type PLpgSQL_raise_option_type |
typedef struct PLpgSQL_rec PLpgSQL_rec |
typedef struct PLpgSQL_recfield PLpgSQL_recfield |
typedef enum PLpgSQL_resolve_option PLpgSQL_resolve_option |
typedef struct PLpgSQL_row PLpgSQL_row |
typedef struct PLpgSQL_stmt PLpgSQL_stmt |
typedef struct PLpgSQL_stmt_assert PLpgSQL_stmt_assert |
typedef struct PLpgSQL_stmt_assign PLpgSQL_stmt_assign |
typedef struct PLpgSQL_stmt_block PLpgSQL_stmt_block |
typedef struct PLpgSQL_stmt_call PLpgSQL_stmt_call |
typedef struct PLpgSQL_stmt_case PLpgSQL_stmt_case |
typedef struct PLpgSQL_stmt_close PLpgSQL_stmt_close |
typedef struct PLpgSQL_stmt_commit PLpgSQL_stmt_commit |
typedef struct PLpgSQL_stmt_dynexecute PLpgSQL_stmt_dynexecute |
typedef struct PLpgSQL_stmt_dynfors PLpgSQL_stmt_dynfors |
typedef struct PLpgSQL_stmt_execsql PLpgSQL_stmt_execsql |
typedef struct PLpgSQL_stmt_exit PLpgSQL_stmt_exit |
typedef struct PLpgSQL_stmt_fetch PLpgSQL_stmt_fetch |
typedef struct PLpgSQL_stmt_forc PLpgSQL_stmt_forc |
typedef struct PLpgSQL_stmt_foreach_a PLpgSQL_stmt_foreach_a |
typedef struct PLpgSQL_stmt_fori PLpgSQL_stmt_fori |
typedef struct PLpgSQL_stmt_forq PLpgSQL_stmt_forq |
typedef struct PLpgSQL_stmt_fors PLpgSQL_stmt_fors |
typedef struct PLpgSQL_stmt_getdiag PLpgSQL_stmt_getdiag |
typedef struct PLpgSQL_stmt_if PLpgSQL_stmt_if |
typedef struct PLpgSQL_stmt_loop PLpgSQL_stmt_loop |
typedef struct PLpgSQL_stmt_open PLpgSQL_stmt_open |
typedef struct PLpgSQL_stmt_perform PLpgSQL_stmt_perform |
typedef struct PLpgSQL_stmt_raise PLpgSQL_stmt_raise |
typedef struct PLpgSQL_stmt_return PLpgSQL_stmt_return |
typedef struct PLpgSQL_stmt_return_next PLpgSQL_stmt_return_next |
typedef struct PLpgSQL_stmt_return_query PLpgSQL_stmt_return_query |
typedef struct PLpgSQL_stmt_rollback PLpgSQL_stmt_rollback |
typedef enum PLpgSQL_stmt_type PLpgSQL_stmt_type |
typedef struct PLpgSQL_stmt_while PLpgSQL_stmt_while |
typedef enum PLpgSQL_trigtype PLpgSQL_trigtype |
typedef struct PLpgSQL_type PLpgSQL_type |
typedef enum PLpgSQL_type_type PLpgSQL_type_type |
typedef struct PLpgSQL_var PLpgSQL_var |
typedef struct PLpgSQL_variable PLpgSQL_variable |
anonymous enum |
enum IdentifierLookup |
enum PLpgSQL_datum_type |
enum PLpgSQL_getdiag_kind |
Definition at line 147 of file plpgsql.h.
enum PLpgSQL_label_type |
enum PLpgSQL_nsitem_type |
enum PLpgSQL_promise_type |
Definition at line 73 of file plpgsql.h.
enum PLpgSQL_stmt_type |
Definition at line 102 of file plpgsql.h.
enum PLpgSQL_trigtype |
enum PLpgSQL_type_type |
int plpgsql_add_initdatums | ( | int ** | varnos | ) |
Definition at line 2373 of file pl_comp.c.
References datums_last, PLpgSQL_datum::dno, i, palloc(), plpgsql_Datums, PLPGSQL_DTYPE_REC, PLPGSQL_DTYPE_VAR, and plpgsql_nDatums.
void plpgsql_adddatum | ( | PLpgSQL_datum * | newdatum | ) |
Definition at line 2312 of file pl_comp.c.
References datums_alloc, PLpgSQL_datum::dno, plpgsql_Datums, plpgsql_nDatums, and repalloc().
Referenced by do_compile(), plpgsql_build_recfield(), plpgsql_build_record(), and plpgsql_build_variable().
void plpgsql_append_source_text | ( | StringInfo | buf, |
int | startlocation, | ||
int | endlocation | ||
) |
Definition at line 421 of file pl_scanner.c.
References appendBinaryStringInfo(), Assert, buf, and scanorig.
int plpgsql_base_yylex | ( | void | ) |
PGDLLEXPORT PLpgSQL_type* plpgsql_build_datatype | ( | Oid | typeOid, |
int32 | typmod, | ||
Oid | collation, | ||
TypeName * | origtypname | ||
) |
Definition at line 2043 of file pl_comp.c.
References build_datatype(), elog, ERROR, HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), and SearchSysCache1().
Referenced by do_compile(), exec_stmt_case(), plpgsql_build_datatype_arrayof(), plpgsql_compile_inline(), plpgsql_parse_cwordrowtype(), and plpgsql_parse_wordrowtype().
PLpgSQL_type* plpgsql_build_datatype_arrayof | ( | PLpgSQL_type * | dtype | ) |
Definition at line 2177 of file pl_comp.c.
References PLpgSQL_type::atttypmod, PLpgSQL_type::collation, ereport, errcode(), errmsg(), ERROR, format_type_be(), get_array_type(), OidIsValid, plpgsql_build_datatype(), PLpgSQL_type::typisarray, and PLpgSQL_type::typoid.
PLpgSQL_recfield* plpgsql_build_recfield | ( | PLpgSQL_rec * | rec, |
const char * | fldname | ||
) |
Definition at line 1996 of file pl_comp.c.
References Assert, PLpgSQL_rec::dno, PLpgSQL_recfield::dno, PLpgSQL_recfield::dtype, PLpgSQL_recfield::fieldname, PLpgSQL_rec::firstfield, i, INVALID_TUPLEDESC_IDENTIFIER, PLpgSQL_recfield::nextfield, palloc0(), plpgsql_adddatum(), plpgsql_Datums, PLPGSQL_DTYPE_RECFIELD, pstrdup(), PLpgSQL_recfield::recparentno, and PLpgSQL_recfield::rectupledescid.
Referenced by plpgsql_parse_dblword(), and plpgsql_parse_tripword().
PLpgSQL_rec* plpgsql_build_record | ( | const char * | refname, |
int | lineno, | ||
PLpgSQL_type * | dtype, | ||
Oid | rectypeid, | ||
bool | add2namespace | ||
) |
Definition at line 1902 of file pl_comp.c.
References PLpgSQL_rec::datatype, PLpgSQL_rec::dno, PLpgSQL_rec::dtype, PLpgSQL_rec::erh, PLpgSQL_rec::firstfield, PLpgSQL_rec::lineno, palloc0(), plpgsql_adddatum(), PLPGSQL_DTYPE_REC, plpgsql_ns_additem(), PLPGSQL_NSTYPE_REC, pstrdup(), PLpgSQL_rec::rectypeid, and PLpgSQL_rec::refname.
Referenced by do_compile(), and plpgsql_build_variable().
PLpgSQL_variable* plpgsql_build_variable | ( | const char * | refname, |
int | lineno, | ||
PLpgSQL_type * | dtype, | ||
bool | add2namespace | ||
) |
Definition at line 1839 of file pl_comp.c.
References PLpgSQL_var::datatype, PLpgSQL_var::dno, PLpgSQL_var::dtype, elog, ereport, errcode(), errmsg(), ERROR, format_type_be(), PLpgSQL_var::freeval, PLpgSQL_var::isnull, PLpgSQL_var::lineno, palloc0(), plpgsql_adddatum(), plpgsql_build_record(), PLPGSQL_DTYPE_VAR, plpgsql_ns_additem(), PLPGSQL_NSTYPE_VAR, PLPGSQL_TTYPE_PSEUDO, PLPGSQL_TTYPE_REC, PLPGSQL_TTYPE_SCALAR, pstrdup(), PLpgSQL_var::refname, PLpgSQL_type::ttype, PLpgSQL_type::typoid, and PLpgSQL_var::value.
Referenced by do_compile(), and plpgsql_compile_inline().
PGDLLEXPORT PLpgSQL_function* plpgsql_compile | ( | FunctionCallInfo | fcinfo, |
bool | forValidator | ||
) |
Definition at line 135 of file pl_comp.c.
References compute_function_hashkey(), delete_function(), do_compile(), elog, ERROR, FunctionCallInfoBaseData::flinfo, FmgrInfo::fn_extra, FmgrInfo::fn_oid, function, GETSTRUCT, HeapTupleHeaderGetRawXmin, HeapTupleIsValid, if(), ItemPointerEquals(), ObjectIdGetDatum(), plpgsql_HashTableLookup(), ReleaseSysCache(), SearchSysCache1(), HeapTupleData::t_data, and HeapTupleData::t_self.
Referenced by plpgsql_call_handler(), and plpgsql_validator().
PLpgSQL_function* plpgsql_compile_inline | ( | char * | proc_source | ) |
Definition at line 842 of file pl_comp.c.
References add_dummy_return(), ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, ErrorContextCallback::arg, ErrorContextCallback::callback, check_function_bodies, CurrentMemoryContext, PLpgSQL_variable::dno, elog, ERROR, error_context_stack, function, InvalidOid, MemoryContextSwitchTo(), palloc0(), plpgsql_build_datatype(), plpgsql_build_variable(), plpgsql_check_syntax, plpgsql_compile_error_callback(), plpgsql_compile_tmp_cxt, plpgsql_curr_compile, plpgsql_DumpExecTree, plpgsql_error_funcname, plpgsql_finish_datums(), PLPGSQL_LABEL_BLOCK, PLPGSQL_NOT_TRIGGER, plpgsql_ns_init(), plpgsql_ns_push(), plpgsql_parse_result, plpgsql_print_strict_params, plpgsql_scanner_finish(), plpgsql_scanner_init(), plpgsql_start_datums(), plpgsql_variable_conflict, plpgsql_yyparse(), ErrorContextCallback::previous, and pstrdup().
Referenced by plpgsql_inline_handler().
void plpgsql_dumptree | ( | PLpgSQL_function * | func | ) |
Definition at line 1600 of file pl_funcs.c.
References PLpgSQL_function::action, PLpgSQL_type::atttypmod, PLpgSQL_var::cursor_explicit_argrow, PLpgSQL_var::cursor_explicit_expr, PLpgSQL_var::datatype, PLpgSQL_function::datums, PLpgSQL_var::default_val, PLpgSQL_datum::dtype, PLpgSQL_rec::dtype, dump_block(), dump_expr(), dump_indent, fflush(), PLpgSQL_row::fieldnames, PLpgSQL_function::fn_signature, i, PLpgSQL_var::isconst, j, PLpgSQL_stmt_block::lineno, PLpgSQL_function::ndatums, PLpgSQL_row::nfields, PLpgSQL_var::notnull, PLPGSQL_DTYPE_PROMISE, PLPGSQL_DTYPE_REC, PLPGSQL_DTYPE_RECFIELD, PLPGSQL_DTYPE_ROW, PLPGSQL_DTYPE_VAR, PLPGSQL_PROMISE_NONE, printf, PLpgSQL_var::promise, PLpgSQL_var::refname, PLpgSQL_row::refname, generate_unaccent_rules::stdout, PLpgSQL_type::typname, PLpgSQL_type::typoid, and PLpgSQL_row::varnos.
Referenced by do_compile().
void plpgsql_exec_event_trigger | ( | PLpgSQL_function * | func, |
EventTriggerData * | trigdata | ||
) |
Definition at line 1159 of file pl_exec.c.
References PLpgSQL_function::action, ErrorContextCallback::arg, ErrorContextCallback::callback, copy_plpgsql_datums(), ereport, PLpgSQL_execstate::err_text, errcode(), errmsg(), ERROR, error_context_stack, PLpgSQL_execstate::evtrigdata, exec_eval_cleanup(), exec_toplevel_block(), PLpgSQL_plugin::func_beg, PLpgSQL_plugin::func_end, gettext_noop, plpgsql_destroy_econtext(), plpgsql_estate_setup(), plpgsql_exec_error_callback(), plpgsql_plugin_ptr, PLPGSQL_RC_RETURN, and ErrorContextCallback::previous.
Referenced by plpgsql_call_handler().
Datum plpgsql_exec_function | ( | PLpgSQL_function * | func, |
FunctionCallInfo | fcinfo, | ||
EState * | simple_eval_estate, | ||
ResourceOwner | simple_eval_resowner, | ||
ResourceOwner | procedure_resowner, | ||
bool | atomic | ||
) |
Definition at line 477 of file pl_exec.c.
References PLpgSQL_function::action, ReturnSetInfo::allowedModes, ErrorContextCallback::arg, FunctionCallInfoBaseData::args, assign_simple_var(), PLpgSQL_execstate::atomic, ErrorContextCallback::callback, coerce_function_result_tuple(), copy_plpgsql_datums(), CreateTupleDescCopy(), PLpgSQL_var::datatype, PLpgSQL_execstate::datum_context, DatumGetPointer(), PLpgSQL_function::datums, PLpgSQL_execstate::datums, domain_check(), PLpgSQL_datum::dtype, elog, ereport, PLpgSQL_execstate::err_text, errcode(), errmsg(), ERROR, error_context_stack, exec_cast_value(), exec_eval_cleanup(), exec_move_row(), exec_move_row_from_datum(), exec_set_found(), exec_toplevel_block(), expand_array(), PLpgSQL_function::fn_argvarnos, PLpgSQL_function::fn_nargs, PLpgSQL_function::fn_retbyval, PLpgSQL_function::fn_retisdomain, PLpgSQL_function::fn_rettype, PLpgSQL_function::fn_rettyplen, PLpgSQL_plugin::func_beg, PLpgSQL_plugin::func_end, get_call_result_type(), gettext_noop, i, if(), IsA, FunctionCallInfoBaseData::isnull, NullableDatum::isnull, PLpgSQL_var::isnull, MemoryContextSwitchTo(), plpgsql_destroy_econtext(), PLPGSQL_DTYPE_REC, PLPGSQL_DTYPE_VAR, plpgsql_estate_setup(), plpgsql_exec_error_callback(), plpgsql_plugin_ptr, PLPGSQL_RC_RETURN, ErrorContextCallback::previous, PLpgSQL_execstate::procedure_resowner, FunctionCallInfoBaseData::resultinfo, PLpgSQL_execstate::retisnull, PLpgSQL_execstate::retisset, PLpgSQL_execstate::retistuple, PLpgSQL_execstate::rettype, ReturnSetInfo::returnMode, PLpgSQL_execstate::retval, PLpgSQL_execstate::rsi, ReturnSetInfo::setDesc, ReturnSetInfo::setResult, SFRM_Materialize, SPI_datumTransfer(), TransferExpandedObject(), PLpgSQL_execstate::tuple_store, PLpgSQL_execstate::tuple_store_cxt, PLpgSQL_execstate::tuple_store_desc, TYPEFUNC_COMPOSITE, TYPEFUNC_COMPOSITE_DOMAIN, TYPEFUNC_RECORD, PLpgSQL_type::typisarray, PLpgSQL_type::typlen, NullableDatum::value, PLpgSQL_var::value, VARATT_IS_EXTERNAL_EXPANDED_RO, and VARATT_IS_EXTERNAL_EXPANDED_RW.
Referenced by plpgsql_call_handler(), and plpgsql_inline_handler().
PGDLLEXPORT Oid plpgsql_exec_get_datum_type | ( | PLpgSQL_execstate * | estate, |
PLpgSQL_datum * | datum | ||
) |
Definition at line 5457 of file pl_exec.c.
References PLpgSQL_var::datatype, PLpgSQL_execstate::datums, PLpgSQL_datum::dtype, elog, ExpandedRecordHeader::er_tupdesc_id, ExpandedRecordHeader::er_typeid, ereport, PLpgSQL_rec::erh, errcode(), errmsg(), ERROR, expanded_record_lookup_field(), PLpgSQL_recfield::fieldname, PLpgSQL_recfield::finfo, ExpandedRecordFieldInfo::ftypeid, instantiate_empty_record_variable(), InvalidOid, PLPGSQL_DTYPE_PROMISE, PLPGSQL_DTYPE_REC, PLPGSQL_DTYPE_RECFIELD, PLPGSQL_DTYPE_VAR, PLpgSQL_recfield::recparentno, PLpgSQL_recfield::rectupledescid, PLpgSQL_rec::rectypeid, PLpgSQL_rec::refname, PLpgSQL_type::typoid, and unlikely.
Referenced by exec_stmt_foreach_a().
void plpgsql_exec_get_datum_type_info | ( | PLpgSQL_execstate * | estate, |
PLpgSQL_datum * | datum, | ||
Oid * | typeId, | ||
int32 * | typMod, | ||
Oid * | collation | ||
) |
Definition at line 5542 of file pl_exec.c.
References PLpgSQL_type::atttypmod, PLpgSQL_type::collation, PLpgSQL_var::datatype, PLpgSQL_execstate::datums, PLpgSQL_datum::dtype, elog, ExpandedRecordHeader::er_tupdesc_id, ExpandedRecordHeader::er_typeid, ereport, PLpgSQL_rec::erh, errcode(), errmsg(), ERROR, expanded_record_lookup_field(), ExpandedRecordFieldInfo::fcollation, PLpgSQL_recfield::fieldname, PLpgSQL_recfield::finfo, ExpandedRecordFieldInfo::ftypeid, ExpandedRecordFieldInfo::ftypmod, instantiate_empty_record_variable(), InvalidOid, PLPGSQL_DTYPE_PROMISE, PLPGSQL_DTYPE_REC, PLPGSQL_DTYPE_RECFIELD, PLPGSQL_DTYPE_VAR, PLpgSQL_recfield::recparentno, PLpgSQL_recfield::rectupledescid, PLpgSQL_rec::rectypeid, PLpgSQL_rec::refname, PLpgSQL_type::typoid, and unlikely.
Referenced by make_datum_param().
HeapTuple plpgsql_exec_trigger | ( | PLpgSQL_function * | func, |
TriggerData * | trigdata | ||
) |
Definition at line 919 of file pl_exec.c.
References PLpgSQL_function::action, ErrorContextCallback::arg, Assert, ErrorContextCallback::callback, TupleDescData::constr, convert_tuples_by_position(), copy_plpgsql_datums(), PLpgSQL_execstate::datum_context, DatumGetEOHP(), DatumGetPointer(), PLpgSQL_execstate::datums, deconstruct_composite_datum(), elog, ER_MAGIC, ExpandedRecordHeader::er_magic, ereport, PLpgSQL_rec::erh, PLpgSQL_execstate::err_text, errcode(), errmsg(), ERROR, error_context_stack, exec_eval_cleanup(), exec_set_found(), exec_toplevel_block(), execute_attr_map_tuple(), expanded_record_get_tupdesc(), expanded_record_get_tuple(), expanded_record_set_field_internal(), expanded_record_set_tuple(), PLpgSQL_plugin::func_beg, PLpgSQL_plugin::func_end, gettext_noop, TupleConstr::has_generated_stored, i, make_expanded_record_from_exprecord(), make_expanded_record_from_tupdesc(), TupleDescData::natts, PLpgSQL_function::new_varno, PLpgSQL_function::old_varno, plpgsql_destroy_econtext(), plpgsql_estate_setup(), plpgsql_exec_error_callback(), plpgsql_plugin_ptr, PLPGSQL_RC_RETURN, ErrorContextCallback::previous, RelationGetDescr, ReleaseTupleDesc, PLpgSQL_execstate::retisnull, PLpgSQL_execstate::retisset, PLpgSQL_execstate::rettype, PLpgSQL_execstate::retval, SPI_copytuple(), SPI_register_trigger_data(), TriggerData::tg_event, TriggerData::tg_newtuple, TriggerData::tg_relation, TriggerData::tg_trigtuple, PLpgSQL_execstate::trigdata, TRIGGER_FIRED_BEFORE, TRIGGER_FIRED_BY_DELETE, TRIGGER_FIRED_BY_INSERT, TRIGGER_FIRED_BY_UPDATE, TRIGGER_FIRED_FOR_ROW, TupleDescAttr, type_is_rowtype(), and VARATT_IS_EXTERNAL_EXPANDED.
Referenced by plpgsql_call_handler().
void plpgsql_free_function_memory | ( | PLpgSQL_function * | func | ) |
Definition at line 727 of file pl_funcs.c.
References PLpgSQL_function::action, Assert, PLpgSQL_var::cursor_explicit_expr, PLpgSQL_function::datums, PLpgSQL_var::default_val, PLpgSQL_rec::default_val, PLpgSQL_datum::dtype, elog, ERROR, PLpgSQL_function::fn_cxt, free_block(), free_expr(), i, MemoryContextDelete(), PLpgSQL_function::ndatums, PLPGSQL_DTYPE_PROMISE, PLPGSQL_DTYPE_REC, PLPGSQL_DTYPE_RECFIELD, PLPGSQL_DTYPE_ROW, PLPGSQL_DTYPE_VAR, and PLpgSQL_function::use_count.
Referenced by delete_function(), and plpgsql_inline_handler().
const char* plpgsql_getdiag_kindname | ( | PLpgSQL_getdiag_kind | kind | ) |
Definition at line 300 of file pl_funcs.c.
References PLPGSQL_GETDIAG_COLUMN_NAME, PLPGSQL_GETDIAG_CONSTRAINT_NAME, PLPGSQL_GETDIAG_CONTEXT, PLPGSQL_GETDIAG_DATATYPE_NAME, PLPGSQL_GETDIAG_ERROR_CONTEXT, PLPGSQL_GETDIAG_ERROR_DETAIL, PLPGSQL_GETDIAG_ERROR_HINT, PLPGSQL_GETDIAG_MESSAGE_TEXT, PLPGSQL_GETDIAG_RETURNED_SQLSTATE, PLPGSQL_GETDIAG_ROUTINE_OID, PLPGSQL_GETDIAG_ROW_COUNT, PLPGSQL_GETDIAG_SCHEMA_NAME, and PLPGSQL_GETDIAG_TABLE_NAME.
Referenced by dump_getdiag().
void plpgsql_HashTableInit | ( | void | ) |
Definition at line 2594 of file pl_comp.c.
References Assert, ctl, FUNCS_PER_USER, HASH_BLOBS, hash_create(), HASH_ELEM, and plpgsql_HashTable.
Referenced by _PG_init().
int plpgsql_latest_lineno | ( | void | ) |
Definition at line 589 of file pl_scanner.c.
References cur_line_num.
Referenced by plpgsql_compile_error_callback().
int plpgsql_location_to_lineno | ( | int | location | ) |
Definition at line 555 of file pl_scanner.c.
References cur_line_end, cur_line_num, cur_line_start, location_lineno_init(), and scanorig.
void plpgsql_ns_additem | ( | PLpgSQL_nsitem_type | itemtype, |
int | itemno, | ||
const char * | name | ||
) |
Definition at line 92 of file pl_funcs.c.
References Assert, PLpgSQL_nsitem::itemno, PLpgSQL_nsitem::itemtype, name, PLpgSQL_nsitem::name, ns_top, palloc(), PLPGSQL_NSTYPE_LABEL, and PLpgSQL_nsitem::prev.
Referenced by add_parameter_name(), plpgsql_build_record(), plpgsql_build_variable(), and plpgsql_ns_push().
PLpgSQL_nsitem* plpgsql_ns_find_nearest_loop | ( | PLpgSQL_nsitem * | ns_cur | ) |
Definition at line 214 of file pl_funcs.c.
References PLpgSQL_nsitem::itemno, PLpgSQL_nsitem::itemtype, PLPGSQL_LABEL_LOOP, PLPGSQL_NSTYPE_LABEL, and PLpgSQL_nsitem::prev.
void plpgsql_ns_init | ( | void | ) |
Definition at line 43 of file pl_funcs.c.
References ns_top.
Referenced by do_compile(), and plpgsql_compile_inline().
PGDLLEXPORT PLpgSQL_nsitem* plpgsql_ns_lookup | ( | PLpgSQL_nsitem * | ns_cur, |
bool | localmode, | ||
const char * | name1, | ||
const char * | name2, | ||
const char * | name3, | ||
int * | names_used | ||
) |
Definition at line 130 of file pl_funcs.c.
References PLpgSQL_nsitem::itemtype, PLpgSQL_nsitem::name, PLPGSQL_NSTYPE_LABEL, PLPGSQL_NSTYPE_VAR, and PLpgSQL_nsitem::prev.
Referenced by add_parameter_name(), plpgsql_param_ref(), plpgsql_parse_cwordtype(), plpgsql_parse_dblword(), plpgsql_parse_tripword(), plpgsql_parse_word(), plpgsql_parse_wordtype(), and resolve_column_ref().
PLpgSQL_nsitem* plpgsql_ns_lookup_label | ( | PLpgSQL_nsitem * | ns_cur, |
const char * | name | ||
) |
Definition at line 195 of file pl_funcs.c.
References PLpgSQL_nsitem::itemtype, name, PLpgSQL_nsitem::name, PLPGSQL_NSTYPE_LABEL, and PLpgSQL_nsitem::prev.
void plpgsql_ns_pop | ( | void | ) |
Definition at line 67 of file pl_funcs.c.
References Assert, PLpgSQL_nsitem::itemtype, ns_top, PLPGSQL_NSTYPE_LABEL, and PLpgSQL_nsitem::prev.
void plpgsql_ns_push | ( | const char * | label, |
PLpgSQL_label_type | label_type | ||
) |
Definition at line 54 of file pl_funcs.c.
References label, plpgsql_ns_additem(), and PLPGSQL_NSTYPE_LABEL.
Referenced by do_compile(), and plpgsql_compile_inline().
PLpgSQL_nsitem* plpgsql_ns_top | ( | void | ) |
Definition at line 81 of file pl_funcs.c.
References ns_top.
Referenced by add_parameter_name(), plpgsql_parse_cwordtype(), plpgsql_parse_dblword(), plpgsql_parse_tripword(), plpgsql_parse_word(), and plpgsql_parse_wordtype().
PLpgSQL_type* plpgsql_parse_cwordrowtype | ( | List * | idents | ) |
Definition at line 1795 of file pl_comp.c.
References ereport, errcode(), errmsg(), ERROR, get_rel_type_id(), InvalidOid, makeRangeVarFromNameList(), makeTypeNameFromNameList(), MemoryContextSwitchTo(), NoLock, OidIsValid, plpgsql_build_datatype(), plpgsql_compile_tmp_cxt, RangeVarGetRelid, and RangeVar::relname.
PLpgSQL_type* plpgsql_parse_cwordtype | ( | List * | idents | ) |
Definition at line 1646 of file pl_comp.c.
References Assert, build_datatype(), elog, ereport, errcode(), errmsg(), ERROR, GETSTRUCT, HeapTupleIsValid, PLpgSQL_nsitem::itemno, PLpgSQL_nsitem::itemtype, linitial, list_copy(), list_delete_last(), list_length(), llast, lsecond, makeRangeVar(), makeRangeVarFromNameList(), MemoryContextSwitchTo(), NoLock, ObjectIdGetDatum(), plpgsql_compile_tmp_cxt, plpgsql_Datums, plpgsql_ns_lookup(), plpgsql_ns_top(), PLPGSQL_NSTYPE_REC, PLPGSQL_NSTYPE_VAR, RangeVarGetRelid, ReleaseSysCache(), RangeVar::relname, SearchSysCache1(), SearchSysCacheAttName(), and strVal.
Definition at line 1440 of file pl_comp.c.
References PLwdatum::datum, PLwdatum::ident, IDENTIFIER_LOOKUP_DECLARE, PLcword::idents, PLwdatum::idents, PLpgSQL_nsitem::itemno, PLpgSQL_nsitem::itemtype, list_make2, makeString(), plpgsql_build_recfield(), plpgsql_Datums, plpgsql_IdentifierLookup, plpgsql_ns_lookup(), plpgsql_ns_top(), PLPGSQL_NSTYPE_REC, PLPGSQL_NSTYPE_VAR, and PLwdatum::quoted.
Referenced by plpgsql_yylex().
PLpgSQL_condition* plpgsql_parse_err_condition | ( | char * | condname | ) |
Definition at line 2244 of file pl_comp.c.
References ereport, errcode(), errmsg(), ERROR, exception_label_map, i, label, ExceptionLabelMap::label, palloc(), and ExceptionLabelMap::sqlerrstate.
bool plpgsql_parse_tripword | ( | char * | word1, |
char * | word2, | ||
char * | word3, | ||
PLwdatum * | wdatum, | ||
PLcword * | cword | ||
) |
Definition at line 1521 of file pl_comp.c.
References PLwdatum::datum, PLwdatum::ident, IDENTIFIER_LOOKUP_DECLARE, PLcword::idents, PLwdatum::idents, PLpgSQL_nsitem::itemno, PLpgSQL_nsitem::itemtype, list_make2, list_make3, makeString(), plpgsql_build_recfield(), plpgsql_Datums, plpgsql_IdentifierLookup, plpgsql_ns_lookup(), plpgsql_ns_top(), PLPGSQL_NSTYPE_REC, and PLwdatum::quoted.
Referenced by plpgsql_yylex().
bool plpgsql_parse_word | ( | char * | word1, |
const char * | yytxt, | ||
bool | lookup, | ||
PLwdatum * | wdatum, | ||
PLword * | word | ||
) |
Definition at line 1385 of file pl_comp.c.
References PLwdatum::datum, elog, ERROR, PLwdatum::ident, IDENTIFIER_LOOKUP_NORMAL, PLwdatum::idents, PLpgSQL_nsitem::itemno, PLpgSQL_nsitem::itemtype, NIL, plpgsql_Datums, plpgsql_IdentifierLookup, plpgsql_ns_lookup(), plpgsql_ns_top(), PLPGSQL_NSTYPE_REC, PLPGSQL_NSTYPE_VAR, PLwdatum::quoted, and word().
Referenced by plpgsql_yylex().
PLpgSQL_type* plpgsql_parse_wordrowtype | ( | char * | ident | ) |
Definition at line 1758 of file pl_comp.c.
References ereport, errcode(), ERRCODE_UNDEFINED_TABLE, errmsg(), ERROR, get_rel_type_id(), ident, InvalidOid, makeTypeName(), OidIsValid, plpgsql_build_datatype(), and RelnameGetRelid().
PLpgSQL_type* plpgsql_parse_wordtype | ( | char * | ident | ) |
Definition at line 1605 of file pl_comp.c.
References ereport, errcode(), errmsg(), ERROR, ident, PLpgSQL_nsitem::itemno, PLpgSQL_nsitem::itemtype, plpgsql_Datums, plpgsql_ns_lookup(), plpgsql_ns_top(), PLPGSQL_NSTYPE_REC, and PLPGSQL_NSTYPE_VAR.
PGDLLEXPORT void plpgsql_parser_setup | ( | struct ParseState * | pstate, |
PLpgSQL_expr * | expr | ||
) |
Definition at line 1076 of file pl_comp.c.
References ParseState::p_paramref_hook, ParseState::p_post_columnref_hook, ParseState::p_pre_columnref_hook, ParseState::p_ref_hook_state, plpgsql_param_ref(), plpgsql_post_column_ref(), and plpgsql_pre_column_ref().
Referenced by exec_prepare_plan(), and plpgsql_estate_setup().
int plpgsql_peek | ( | void | ) |
Definition at line 437 of file pl_scanner.c.
References internal_yylex(), and push_back_token().
void plpgsql_peek2 | ( | int * | tok1_p, |
int * | tok2_p, | ||
int * | tok1_loc, | ||
int * | tok2_loc | ||
) |
Definition at line 456 of file pl_scanner.c.
References internal_yylex(), TokenAuxData::lloc, and push_back_token().
void plpgsql_push_back_token | ( | int | token | ) |
Definition at line 387 of file pl_scanner.c.
References TokenAuxData::leng, TokenAuxData::lloc, TokenAuxData::lval, plpgsql_yyleng, push_back_token(), and token.
PGDLLEXPORT int plpgsql_recognize_err_condition | ( | const char * | condname, |
bool | allow_sqlstate | ||
) |
Definition at line 2208 of file pl_comp.c.
References ereport, errcode(), errmsg(), ERROR, exception_label_map, i, label, ExceptionLabelMap::label, MAKE_SQLSTATE, and ExceptionLabelMap::sqlerrstate.
Referenced by exec_stmt_raise().
int plpgsql_scanner_errposition | ( | int | location | ) |
Definition at line 489 of file pl_scanner.c.
References internalerrposition(), internalerrquery(), pg_mbstrlen_with_len(), and scanorig.
Referenced by plpgsql_yyerror().
void plpgsql_scanner_finish | ( | void | ) |
Definition at line 630 of file pl_scanner.c.
References scanner_finish(), scanorig, and yyscanner.
Referenced by do_compile(), and plpgsql_compile_inline().
void plpgsql_scanner_init | ( | const char * | str | ) |
Definition at line 603 of file pl_scanner.c.
References core_yy, IDENTIFIER_LOOKUP_NORMAL, location_lineno_init(), num_pushbacks, plpgsql_IdentifierLookup, plpgsql_yytoken, ReservedPLKeywordTokens, scanner_init(), scanorig, str, and yyscanner.
Referenced by do_compile(), and plpgsql_compile_inline().
PGDLLEXPORT const char* plpgsql_stmt_typename | ( | PLpgSQL_stmt * | stmt | ) |
Definition at line 232 of file pl_funcs.c.
References _, PLPGSQL_STMT_ASSERT, PLPGSQL_STMT_ASSIGN, PLPGSQL_STMT_BLOCK, PLPGSQL_STMT_CALL, PLPGSQL_STMT_CASE, PLPGSQL_STMT_CLOSE, PLPGSQL_STMT_COMMIT, PLPGSQL_STMT_DYNEXECUTE, PLPGSQL_STMT_DYNFORS, PLPGSQL_STMT_EXECSQL, PLPGSQL_STMT_EXIT, PLPGSQL_STMT_FETCH, PLPGSQL_STMT_FORC, PLPGSQL_STMT_FOREACH_A, PLPGSQL_STMT_FORI, PLPGSQL_STMT_FORS, PLPGSQL_STMT_GETDIAG, PLPGSQL_STMT_IF, PLPGSQL_STMT_LOOP, PLPGSQL_STMT_OPEN, PLPGSQL_STMT_PERFORM, PLPGSQL_STMT_RAISE, PLPGSQL_STMT_RETURN, PLPGSQL_STMT_RETURN_NEXT, PLPGSQL_STMT_RETURN_QUERY, PLPGSQL_STMT_ROLLBACK, PLPGSQL_STMT_WHILE, and stmt.
Referenced by plpgsql_exec_error_callback().
void plpgsql_subxact_cb | ( | SubXactEvent | event, |
SubTransactionId | mySubid, | ||
SubTransactionId | parentSubid, | ||
void * | arg | ||
) |
Definition at line 8524 of file pl_exec.c.
References FreeExprContext(), next, SimpleEcontextStackEntry::next, pfree(), simple_econtext_stack, SimpleEcontextStackEntry::stack_econtext, SUBXACT_EVENT_ABORT_SUB, SUBXACT_EVENT_COMMIT_SUB, and SimpleEcontextStackEntry::xact_subxid.
Referenced by _PG_init(), and plpgsql_inline_handler().
bool plpgsql_token_is_unreserved_keyword | ( | int | token | ) |
Definition at line 404 of file pl_scanner.c.
References i, lengthof, token, and UnreservedPLKeywordTokens.
int plpgsql_token_length | ( | void | ) |
Definition at line 313 of file pl_scanner.c.
References plpgsql_yyleng.
void plpgsql_xact_cb | ( | XactEvent | event, |
void * | arg | ||
) |
Definition at line 8482 of file pl_exec.c.
References FreeExecutorState(), ReleaseAllPlanCacheRefsInOwner(), shared_simple_eval_estate, shared_simple_eval_resowner, simple_econtext_stack, XACT_EVENT_ABORT, XACT_EVENT_COMMIT, XACT_EVENT_PARALLEL_ABORT, XACT_EVENT_PARALLEL_COMMIT, and XACT_EVENT_PREPARE.
Referenced by _PG_init().
void plpgsql_yyerror | ( | const char * | message | ) |
Definition at line 516 of file pl_scanner.c.
References _, core_yy, ereport, errcode(), errmsg(), ERROR, plpgsql_scanner_errposition(), plpgsql_yyleng, and core_yy_extra_type::scanbuf.
int plpgsql_yylex | ( | void | ) |
Definition at line 146 of file pl_scanner.c.
References AT_STMT_START, core_yy, GetScanKeyword(), internal_yylex(), TokenAuxData::leng, TokenAuxData::lloc, TokenAuxData::lval, plpgsql_parse_dblword(), plpgsql_parse_tripword(), plpgsql_parse_word(), plpgsql_yyleng, plpgsql_yytoken, push_back_token(), core_yy_extra_type::scanbuf, ScanKeywordLookup(), and UnreservedPLKeywordTokens.
int plpgsql_yyparse | ( | void | ) |
Referenced by do_compile(), and plpgsql_compile_inline().
|
extern |
Definition at line 48 of file pl_handler.c.
Referenced by _PG_init(), and exec_stmt_assert().
|
extern |
Definition at line 50 of file pl_comp.c.
Referenced by do_compile(), and plpgsql_compile_inline().
|
extern |
Definition at line 55 of file pl_comp.c.
Referenced by do_compile(), plpgsql_compile_inline(), plpgsql_parse_cwordrowtype(), plpgsql_parse_cwordtype(), and plpgsql_start_datums().
|
extern |
Definition at line 52 of file pl_comp.c.
Referenced by do_compile(), and plpgsql_compile_inline().
|
extern |
Definition at line 45 of file pl_comp.c.
Referenced by plpgsql_add_initdatums(), plpgsql_adddatum(), plpgsql_build_recfield(), plpgsql_finish_datums(), plpgsql_parse_cwordtype(), plpgsql_parse_dblword(), plpgsql_parse_tripword(), plpgsql_parse_word(), plpgsql_parse_wordtype(), and plpgsql_start_datums().
|
extern |
Definition at line 49 of file pl_comp.c.
Referenced by do_compile(), and plpgsql_compile_inline().
|
extern |
Definition at line 48 of file pl_comp.c.
Referenced by do_compile(), plpgsql_compile_error_callback(), and plpgsql_compile_inline().
|
extern |
Definition at line 53 of file pl_handler.c.
Referenced by do_compile(), exec_move_row_from_fields(), exec_stmt_execsql(), and plpgsql_extra_errors_assign_hook().
|
extern |
Definition at line 52 of file pl_handler.c.
Referenced by do_compile(), exec_move_row_from_fields(), exec_stmt_execsql(), and plpgsql_extra_warnings_assign_hook().
|
extern |
Definition at line 26 of file pl_scanner.c.
Referenced by plpgsql_parse_dblword(), plpgsql_parse_tripword(), plpgsql_parse_word(), and plpgsql_scanner_init().
|
extern |
Definition at line 44 of file pl_comp.c.
Referenced by plpgsql_add_initdatums(), plpgsql_adddatum(), plpgsql_finish_datums(), and plpgsql_start_datums().
|
extern |
Definition at line 41 of file pl_comp.c.
Referenced by do_compile(), and plpgsql_compile_inline().
|
extern |
Definition at line 56 of file pl_handler.c.
Referenced by _PG_init(), exec_stmts(), exec_toplevel_block(), plpgsql_estate_setup(), plpgsql_exec_event_trigger(), plpgsql_exec_function(), and plpgsql_exec_trigger().
|
extern |
Definition at line 46 of file pl_handler.c.
Referenced by _PG_init(), do_compile(), and plpgsql_compile_inline().
|
extern |
Definition at line 44 of file pl_handler.c.
Referenced by _PG_init(), do_compile(), and plpgsql_compile_inline().