PostgreSQL Source Code
git master
|
#include "commands/trigger.h"
#include "lib/ilist.h"
#include "parser/parser.h"
#include "utils/portal.h"
Go to the source code of this file.
Data Structures | |
struct | SPITupleTable |
struct | SPIPrepareOptions |
struct | SPIExecuteOptions |
struct | SPIParseOpenOptions |
Typedefs | |
typedef struct SPITupleTable | SPITupleTable |
typedef struct SPIPrepareOptions | SPIPrepareOptions |
typedef struct SPIExecuteOptions | SPIExecuteOptions |
typedef struct SPIParseOpenOptions | SPIParseOpenOptions |
typedef struct _SPI_plan * | SPIPlanPtr |
Variables | |
PGDLLIMPORT uint64 | SPI_processed |
PGDLLIMPORT SPITupleTable * | SPI_tuptable |
PGDLLIMPORT int | SPI_result |
typedef struct SPIExecuteOptions SPIExecuteOptions |
typedef struct SPIParseOpenOptions SPIParseOpenOptions |
typedef struct _SPI_plan* SPIPlanPtr |
typedef struct SPIPrepareOptions SPIPrepareOptions |
typedef struct SPITupleTable SPITupleTable |
void AtEOSubXact_SPI | ( | bool | isCommit, |
SubTransactionId | mySubid | ||
) |
Definition at line 482 of file spi.c.
References _SPI_connected, _SPI_current, _SPI_stack, slist_mutable_iter::cur, ereport, errcode(), errhint(), errmsg(), _SPI_connection::execCxt, _SPI_connection::execSubid, InvalidSubTransactionId, MemoryContextDelete(), MemoryContextReset(), next, slist_container, slist_delete_current(), slist_foreach_modify, SPI_processed, SPI_result, SPI_tuptable, SPITupleTable::subid, SPITupleTable::tuptabcxt, _SPI_connection::tuptable, _SPI_connection::tuptables, and WARNING.
Referenced by AbortSubTransaction(), and CommitSubTransaction().
void AtEOXact_SPI | ( | bool | isCommit | ) |
Definition at line 428 of file spi.c.
References _SPI_connected, _SPI_current, _SPI_stack, ereport, errcode(), errhint(), errmsg(), SPI_processed, SPI_result, SPI_tuptable, and WARNING.
Referenced by AbortTransaction(), CommitTransaction(), and PrepareTransaction().
void SPI_commit | ( | void | ) |
Definition at line 320 of file spi.c.
References _SPI_commit().
Referenced by exec_stmt_commit(), plperl_spi_commit(), pltcl_commit(), and PLy_commit().
void SPI_commit_and_chain | ( | void | ) |
int SPI_connect | ( | void | ) |
Definition at line 94 of file spi.c.
References SPI_connect_ext().
Referenced by check_foreign_key(), check_primary_key(), connectby(), crosstab(), cursor_to_xml(), cursor_to_xmlschema(), database_to_xml_internal(), database_to_xmlschema_internal(), get_crosstab_tuplestore(), get_tuple_of_interest(), initialize_worker_spi(), load_categories_hash(), pg_get_ruledef_worker(), pg_get_viewdef_worker(), plperl_event_trigger_handler(), plperl_trigger_handler(), plpgsql_validator(), plsample_trigger_handler(), pltcl_event_trigger_handler(), pltcl_trigger_handler(), query_to_xml_and_xmlschema(), query_to_xml_internal(), query_to_xmlschema(), refresh_by_match_merge(), ri_Check_Pk_Match(), RI_FKey_cascade_del(), RI_FKey_cascade_upd(), RI_FKey_check(), RI_Initial_Check(), RI_PartitionRemove_Check(), ri_restrict(), ri_set(), schema_to_xml_internal(), schema_to_xmlschema_internal(), test_predtest(), ts_stat1(), ts_stat2(), tsquery_rewrite_query(), ttdummy(), worker_spi_main(), and xpath_table().
int SPI_connect_ext | ( | int | options | ) |
Definition at line 100 of file spi.c.
References _SPI_connected, _SPI_current, _SPI_stack, _SPI_stack_depth, ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, Assert, _SPI_connection::atomic, _SPI_connection::connectSubid, elog, ERROR, _SPI_connection::execCxt, _SPI_connection::execSubid, false, GetCurrentSubTransactionId(), _SPI_connection::internal_xact, InvalidSubTransactionId, MemoryContextAlloc(), MemoryContextSwitchTo(), _SPI_connection::outer_processed, _SPI_connection::outer_result, _SPI_connection::outer_tuptable, PortalContext, _SPI_connection::procCxt, _SPI_connection::processed, _SPI_connection::queryEnv, repalloc(), _SPI_connection::savedcxt, slist_init(), SPI_OK_CONNECT, SPI_OPT_NONATOMIC, SPI_processed, SPI_result, SPI_tuptable, TopMemoryContext, TopTransactionContext, _SPI_connection::tuptable, and _SPI_connection::tuptables.
Referenced by plperl_func_handler(), plperl_inline_handler(), plpgsql_call_handler(), plpgsql_inline_handler(), plpython3_call_handler(), plpython3_inline_handler(), pltcl_func_handler(), and SPI_connect().
Definition at line 1047 of file spi.c.
References _SPI_current, heap_copytuple(), MemoryContextSwitchTo(), _SPI_connection::savedcxt, SPI_ERROR_ARGUMENT, SPI_ERROR_UNCONNECTED, and SPI_result.
Referenced by get_tuple_of_interest(), and plpgsql_exec_trigger().
void SPI_cursor_close | ( | Portal | portal | ) |
Definition at line 1862 of file spi.c.
References elog, ERROR, PortalDrop(), and PortalIsValid.
Referenced by exec_stmt_close(), exec_stmt_dynfors(), exec_stmt_forc(), exec_stmt_fors(), plperl_spi_cursor_close(), plperl_spi_fetchrow(), PLy_cursor_close(), PLy_cursor_dealloc(), query_to_xml_and_xmlschema(), query_to_xmlschema(), ts_stat_sql(), and tsquery_rewrite_query().
Definition at line 1806 of file spi.c.
References _SPI_cursor_operation(), CreateDestReceiver(), DestSPI, FETCH_BACKWARD, and FETCH_FORWARD.
Referenced by cursor_to_xml(), exec_for_query(), plperl_spi_fetchrow(), PLy_cursor_fetch(), PLy_cursor_iternext(), ts_stat_sql(), and tsquery_rewrite_query().
Portal SPI_cursor_find | ( | const char * | name | ) |
Definition at line 1794 of file spi.c.
References GetPortalByName(), and name.
Referenced by cursor_to_xml(), cursor_to_xmlschema(), exec_stmt_close(), exec_stmt_fetch(), exec_stmt_forc(), exec_stmt_open(), plperl_spi_cursor_close(), and plperl_spi_fetchrow().
Definition at line 1821 of file spi.c.
References _SPI_cursor_operation(), FETCH_BACKWARD, FETCH_FORWARD, and None_Receiver.
Portal SPI_cursor_open | ( | const char * | name, |
SPIPlanPtr | plan, | ||
Datum * | Values, | ||
const char * | Nulls, | ||
bool | read_only | ||
) |
Definition at line 1445 of file spi.c.
References _SPI_convert_params(), name, Nulls, pfree(), plan, and SPI_cursor_open_internal().
Referenced by plperl_spi_query(), plperl_spi_query_prepared(), PLy_cursor_plan(), PLy_cursor_query(), query_to_xml_and_xmlschema(), query_to_xmlschema(), ts_stat_sql(), and tsquery_rewrite_query().
Portal SPI_cursor_open_with_args | ( | const char * | name, |
const char * | src, | ||
int | nargs, | ||
Oid * | argtypes, | ||
Datum * | Values, | ||
const char * | Nulls, | ||
bool | read_only, | ||
int | cursorOptions | ||
) |
Definition at line 1472 of file spi.c.
References _SPI_begin_call(), _SPI_convert_params(), _SPI_end_call(), _SPI_PLAN_MAGIC, _SPI_prepare_plan(), elog, ERROR, name, Nulls, plan, RAW_PARSE_DEFAULT, SPI_cursor_open_internal(), and SPI_result.
Portal SPI_cursor_open_with_paramlist | ( | const char * | name, |
SPIPlanPtr | plan, | ||
ParamListInfo | params, | ||
bool | read_only | ||
) |
Definition at line 1525 of file spi.c.
References name, plan, and SPI_cursor_open_internal().
Referenced by exec_run_select(), exec_stmt_forc(), and exec_stmt_open().
Portal SPI_cursor_parse_open | ( | const char * | name, |
const char * | src, | ||
const SPIParseOpenOptions * | options | ||
) |
Definition at line 1533 of file spi.c.
References _SPI_begin_call(), _SPI_end_call(), _SPI_PLAN_MAGIC, _SPI_prepare_plan(), elog, ERROR, name, plan, RAW_PARSE_DEFAULT, SPI_cursor_open_internal(), and SPI_result.
Referenced by exec_dynquery_with_params().
Definition at line 1361 of file spi.c.
References _SPI_current, datumTransfer(), elog, ERROR, MemoryContextSwitchTo(), _SPI_connection::savedcxt, and value.
Referenced by coerce_function_result_tuple(), and plpgsql_exec_function().
int SPI_exec | ( | const char * | src, |
long | tcount | ||
) |
Definition at line 630 of file spi.c.
References SPI_execute().
Referenced by get_tuple_of_interest(), refresh_by_match_merge(), and xpath_table().
int SPI_execp | ( | SPIPlanPtr | plan, |
Datum * | Values, | ||
const char * | Nulls, | ||
long | tcount | ||
) |
Definition at line 704 of file spi.c.
References Nulls, plan, and SPI_execute_plan().
Referenced by check_foreign_key(), check_primary_key(), and ttdummy().
int SPI_execute | ( | const char * | src, |
bool | read_only, | ||
long | tcount | ||
) |
Definition at line 596 of file spi.c.
References _SPI_begin_call(), _SPI_end_call(), _SPI_execute_plan(), _SPI_PLAN_MAGIC, _SPI_prepare_oneshot_plan(), CURSOR_OPT_PARALLEL_OK, InvalidSnapshot, options, plan, RAW_PARSE_DEFAULT, res, and SPI_ERROR_ARGUMENT.
Referenced by build_tuplestore_recursively(), crosstab(), get_crosstab_tuplestore(), initialize_worker_spi(), load_categories_hash(), plperl_spi_exec(), pltcl_SPI_execute(), PLy_spi_execute_query(), query_to_oid_list(), query_to_xml_internal(), refresh_by_match_merge(), SPI_exec(), and worker_spi_main().
int SPI_execute_extended | ( | const char * | src, |
const SPIExecuteOptions * | options | ||
) |
Definition at line 637 of file spi.c.
References _SPI_begin_call(), _SPI_end_call(), _SPI_execute_plan(), _SPI_PLAN_MAGIC, _SPI_prepare_oneshot_plan(), CURSOR_OPT_PARALLEL_OK, InvalidSnapshot, plan, RAW_PARSE_DEFAULT, res, and SPI_ERROR_ARGUMENT.
Referenced by exec_stmt_dynexecute(), and exec_stmt_return_query().
int SPI_execute_plan | ( | SPIPlanPtr | plan, |
Datum * | Values, | ||
const char * | Nulls, | ||
bool | read_only, | ||
long | tcount | ||
) |
Definition at line 672 of file spi.c.
References _SPI_begin_call(), _SPI_convert_params(), _SPI_end_call(), _SPI_execute_plan(), _SPI_PLAN_MAGIC, InvalidSnapshot, Nulls, options, plan, res, SPI_ERROR_ARGUMENT, and SPI_ERROR_PARAM.
Referenced by pg_get_ruledef_worker(), pg_get_viewdef_worker(), plperl_spi_exec_prepared(), pltcl_SPI_execute_plan(), PLy_spi_execute_plan(), SPI_execp(), and test_predtest().
int SPI_execute_plan_extended | ( | SPIPlanPtr | plan, |
const SPIExecuteOptions * | options | ||
) |
Definition at line 711 of file spi.c.
References _SPI_begin_call(), _SPI_end_call(), _SPI_execute_plan(), _SPI_PLAN_MAGIC, InvalidSnapshot, plan, res, and SPI_ERROR_ARGUMENT.
Referenced by exec_stmt_call(), and exec_stmt_return_query().
int SPI_execute_plan_with_paramlist | ( | SPIPlanPtr | plan, |
ParamListInfo | params, | ||
bool | read_only, | ||
long | tcount | ||
) |
Definition at line 733 of file spi.c.
References _SPI_begin_call(), _SPI_end_call(), _SPI_execute_plan(), _SPI_PLAN_MAGIC, InvalidSnapshot, options, plan, res, and SPI_ERROR_ARGUMENT.
Referenced by exec_run_select(), and exec_stmt_execsql().
int SPI_execute_snapshot | ( | SPIPlanPtr | plan, |
Datum * | Values, | ||
const char * | Nulls, | ||
Snapshot | snapshot, | ||
Snapshot | crosscheck_snapshot, | ||
bool | read_only, | ||
bool | fire_triggers, | ||
long | tcount | ||
) |
Definition at line 773 of file spi.c.
References _SPI_begin_call(), _SPI_convert_params(), _SPI_end_call(), _SPI_execute_plan(), _SPI_PLAN_MAGIC, Nulls, options, plan, res, SPI_ERROR_ARGUMENT, and SPI_ERROR_PARAM.
Referenced by RI_Initial_Check(), RI_PartitionRemove_Check(), and ri_PerformCheck().
int SPI_execute_with_args | ( | const char * | src, |
int | nargs, | ||
Oid * | argtypes, | ||
Datum * | Values, | ||
const char * | Nulls, | ||
bool | read_only, | ||
long | tcount | ||
) |
Definition at line 812 of file spi.c.
References _SPI_begin_call(), _SPI_convert_params(), _SPI_end_call(), _SPI_execute_plan(), _SPI_PLAN_MAGIC, _SPI_prepare_oneshot_plan(), CURSOR_OPT_PARALLEL_OK, InvalidSnapshot, Nulls, options, plan, RAW_PARSE_DEFAULT, res, SPI_ERROR_ARGUMENT, and SPI_ERROR_PARAM.
int SPI_finish | ( | void | ) |
Definition at line 182 of file spi.c.
References _SPI_begin_call(), _SPI_connected, _SPI_current, _SPI_stack, _SPI_connection::execCxt, MemoryContextDelete(), MemoryContextSwitchTo(), _SPI_connection::outer_processed, _SPI_connection::outer_result, _SPI_connection::outer_tuptable, _SPI_connection::procCxt, res, _SPI_connection::savedcxt, SPI_OK_FINISH, SPI_processed, SPI_result, and SPI_tuptable.
Referenced by check_foreign_key(), check_primary_key(), connectby(), crosstab(), cursor_to_xml(), cursor_to_xmlschema(), database_to_xml_internal(), database_to_xmlschema_internal(), get_crosstab_tuplestore(), get_tuple_of_interest(), initialize_worker_spi(), load_categories_hash(), pg_get_ruledef_worker(), pg_get_viewdef_worker(), plperl_event_trigger_handler(), plperl_func_handler(), plperl_inline_handler(), plperl_trigger_handler(), plpgsql_call_handler(), plpgsql_inline_handler(), plpgsql_validator(), plsample_trigger_handler(), pltcl_event_trigger_handler(), pltcl_func_handler(), pltcl_trigger_handler(), PLy_exec_function(), PLy_exec_trigger(), query_to_xml_and_xmlschema(), query_to_xml_internal(), query_to_xmlschema(), refresh_by_match_merge(), ri_Check_Pk_Match(), RI_FKey_cascade_del(), RI_FKey_cascade_upd(), RI_FKey_check(), RI_Initial_Check(), RI_PartitionRemove_Check(), ri_restrict(), ri_set(), schema_to_xml_internal(), schema_to_xmlschema_internal(), test_predtest(), ts_stat1(), ts_stat2(), tsquery_rewrite_query(), ttdummy(), worker_spi_main(), and xpath_table().
char* SPI_fname | ( | TupleDesc | tupdesc, |
int | fnumber | ||
) |
Definition at line 1198 of file spi.c.
References FirstLowInvalidHeapAttributeNumber, FormData_pg_attribute, NameStr, TupleDescData::natts, pstrdup(), SPI_ERROR_NOATTRIBUTE, SPI_result, SystemAttributeDefinition(), and TupleDescAttr.
Referenced by get_pkey_attnames(), and SPI_sql_row_to_xmlelement().
int SPI_fnumber | ( | TupleDesc | tupdesc, |
const char * | fname | ||
) |
Definition at line 1175 of file spi.c.
References FormData_pg_attribute, namestrcmp(), TupleDescData::natts, res, SPI_ERROR_NOATTRIBUTE, SystemAttributeByName(), and TupleDescAttr.
Referenced by autoinc(), check_foreign_key(), check_primary_key(), insert_username(), lo_manage(), make_ruledef(), make_viewdef(), moddatetime(), plperl_build_tuple_result(), plperl_modify_tuple(), pltcl_build_tuple_result(), PLy_modify_tuple(), tsvector_update_trigger(), and ttdummy().
int SPI_freeplan | ( | SPIPlanPtr | plan | ) |
Definition at line 1025 of file spi.c.
References _SPI_PLAN_MAGIC, DropCachedPlan(), lfirst, MemoryContextDelete(), plan, and SPI_ERROR_ARGUMENT.
Referenced by free_expr(), plperl_spi_freeplan(), plperl_spi_prepare(), plperl_spi_query(), PLy_cursor_query(), PLy_plan_dealloc(), ri_FetchPreparedPlan(), ts_stat_sql(), and tsquery_rewrite_query().
void SPI_freetuple | ( | HeapTuple | tuple | ) |
void SPI_freetuptable | ( | SPITupleTable * | tuptable | ) |
Definition at line 1386 of file spi.c.
References _SPI_current, slist_mutable_iter::cur, elog, MemoryContextDelete(), next, slist_container, slist_delete_current(), slist_foreach_modify, SPI_tuptable, SPITupleTable::tuptabcxt, _SPI_connection::tuptable, _SPI_connection::tuptables, and WARNING.
Referenced by _SPI_execute_plan(), exec_eval_cleanup(), exec_for_query(), exec_stmt_call(), exec_stmt_dynexecute(), exec_stmt_execsql(), exec_stmt_fetch(), plperl_spi_execute_fetch_result(), plperl_spi_fetchrow(), pltcl_process_SPI_result(), PLy_cursor_fetch(), PLy_cursor_iternext(), PLy_spi_execute_fetch_result(), ts_stat_sql(), and tsquery_rewrite_query().
int SPI_getargcount | ( | SPIPlanPtr | plan | ) |
Definition at line 1890 of file spi.c.
References _SPI_PLAN_MAGIC, plan, SPI_ERROR_ARGUMENT, and SPI_result.
Oid SPI_getargtypeid | ( | SPIPlanPtr | plan, |
int | argIndex | ||
) |
Definition at line 1875 of file spi.c.
References _SPI_PLAN_MAGIC, InvalidOid, plan, SPI_ERROR_ARGUMENT, and SPI_result.
Definition at line 1252 of file spi.c.
References FirstLowInvalidHeapAttributeNumber, heap_getattr(), TupleDescData::natts, SPI_ERROR_NOATTRIBUTE, and SPI_result.
Referenced by autoinc(), check_foreign_key(), check_primary_key(), exec_eval_expr(), initialize_worker_spi(), make_ruledef(), make_viewdef(), query_to_oid_list(), SPI_sql_row_to_xmlelement(), test_predtest(), ts_stat_sql(), tsquery_rewrite_query(), tsvector_update_trigger(), ttdummy(), and worker_spi_main().
char* SPI_getnspname | ( | Relation | rel | ) |
Definition at line 1332 of file spi.c.
References get_namespace_name(), and RelationGetNamespace.
Referenced by plperl_trigger_build_args(), plsample_trigger_handler(), pltcl_trigger_handler(), and PLy_trigger_build_args().
char* SPI_getrelname | ( | Relation | rel | ) |
Definition at line 1326 of file spi.c.
References pstrdup(), and RelationGetRelationName.
Referenced by autoinc(), check_foreign_key(), check_primary_key(), insert_username(), moddatetime(), plperl_trigger_build_args(), plsample_trigger_handler(), pltcl_trigger_handler(), PLy_trigger_build_args(), and ttdummy().
char* SPI_gettype | ( | TupleDesc | tupdesc, |
int | fnumber | ||
) |
Definition at line 1268 of file spi.c.
References FirstLowInvalidHeapAttributeNumber, GETSTRUCT, HeapTupleIsValid, NameStr, TupleDescData::natts, ObjectIdGetDatum(), pstrdup(), ReleaseSysCache(), SearchSysCache1(), SPI_ERROR_NOATTRIBUTE, SPI_ERROR_TYPUNKNOWN, SPI_result, SystemAttributeDefinition(), TupleDescAttr, and typname.
Referenced by check_foreign_key().
Definition at line 1308 of file spi.c.
References FirstLowInvalidHeapAttributeNumber, InvalidOid, TupleDescData::natts, SPI_ERROR_NOATTRIBUTE, SPI_result, SystemAttributeDefinition(), and TupleDescAttr.
Referenced by autoinc(), check_foreign_key(), check_primary_key(), insert_username(), moddatetime(), SPI_sql_row_to_xmlelement(), ts_stat_sql(), tsquery_rewrite_query(), tsvector_update_trigger(), and ttdummy().
Definition at line 1220 of file spi.c.
References FirstLowInvalidHeapAttributeNumber, getTypeOutputInfo(), heap_getattr(), TupleDescData::natts, OidOutputFunctionCall(), SPI_ERROR_NOATTRIBUTE, SPI_result, SystemAttributeDefinition(), TupleDescAttr, and val.
Referenced by build_tuplestore_recursively(), check_foreign_key(), crosstab(), get_crosstab_tuplestore(), get_sql_insert(), get_sql_update(), lo_manage(), load_categories_hash(), make_ruledef(), make_viewdef(), refresh_by_match_merge(), triggered_change_notification(), and xpath_table().
bool SPI_inside_nonatomic_context | ( | void | ) |
Definition at line 581 of file spi.c.
References _SPI_current, _SPI_connection::atomic, and IsSubTransaction().
Referenced by StartTransaction().
bool SPI_is_cursor_plan | ( | SPIPlanPtr | plan | ) |
Definition at line 1910 of file spi.c.
References _SPI_PLAN_MAGIC, linitial, list_length(), plan, CachedPlanSource::resultDesc, SPI_ERROR_ARGUMENT, and SPI_result.
Referenced by SPI_cursor_open_internal().
int SPI_keepplan | ( | SPIPlanPtr | plan | ) |
Definition at line 976 of file spi.c.
References _SPI_PLAN_MAGIC, CacheMemoryContext, lfirst, MemoryContextSetParent(), plan, SaveCachedPlan(), and SPI_ERROR_ARGUMENT.
Referenced by check_foreign_key(), check_primary_key(), exec_prepare_plan(), pg_get_ruledef_worker(), pg_get_viewdef_worker(), plperl_spi_prepare(), pltcl_SPI_prepare(), PLy_spi_prepare(), ri_PlanCheck(), and ttdummy().
HeapTuple SPI_modifytuple | ( | Relation | rel, |
HeapTuple | tuple, | ||
int | natts, | ||
int * | attnum, | ||
Datum * | Values, | ||
const char * | Nulls | ||
) |
Definition at line 1106 of file spi.c.
References _SPI_current, attnum, heap_deform_tuple(), heap_form_tuple(), i, MemoryContextSwitchTo(), TupleDescData::natts, Nulls, palloc(), pfree(), RelationData::rd_att, _SPI_connection::savedcxt, SPI_ERROR_ARGUMENT, SPI_ERROR_NOATTRIBUTE, SPI_ERROR_UNCONNECTED, SPI_result, HeapTupleHeaderData::t_ctid, HeapTupleData::t_data, HeapTupleData::t_self, and HeapTupleData::t_tableOid.
Referenced by ttdummy().
void* SPI_palloc | ( | Size | size | ) |
Definition at line 1338 of file spi.c.
References _SPI_current, elog, ERROR, MemoryContextAlloc(), _SPI_connection::savedcxt, and size.
Referenced by _SPI_strdup(), and coerce_function_result_tuple().
void SPI_pfree | ( | void * | pointer | ) |
CachedPlan* SPI_plan_get_cached_plan | ( | SPIPlanPtr | plan | ) |
Definition at line 2076 of file spi.c.
References _SPI_current, _SPI_error_callback(), _SPI_PLAN_MAGIC, ErrorContextCallback::arg, Assert, ErrorContextCallback::callback, CurrentResourceOwner, error_context_stack, GetCachedPlan(), CachedPlanSource::gplan, linitial, list_length(), SPICallbackArg::mode, plan, ErrorContextCallback::previous, SPICallbackArg::query, CachedPlanSource::query_string, and _SPI_connection::queryEnv.
Referenced by exec_eval_simple_expr(), exec_simple_check_plan(), make_callstmt_target(), and test_predtest().
List* SPI_plan_get_plan_sources | ( | SPIPlanPtr | plan | ) |
Definition at line 2057 of file spi.c.
References _SPI_PLAN_MAGIC, Assert, and plan.
Referenced by exec_is_simple_query(), exec_simple_check_plan(), and exec_stmt_execsql().
bool SPI_plan_is_valid | ( | SPIPlanPtr | plan | ) |
Definition at line 1948 of file spi.c.
References _SPI_PLAN_MAGIC, Assert, CachedPlanIsValid(), lfirst, and plan.
Referenced by ri_FetchPreparedPlan().
SPIPlanPtr SPI_prepare | ( | const char * | src, |
int | nargs, | ||
Oid * | argtypes | ||
) |
Definition at line 860 of file spi.c.
References SPI_prepare_cursor().
Referenced by check_foreign_key(), check_primary_key(), pg_get_ruledef_worker(), pg_get_viewdef_worker(), plperl_spi_prepare(), plperl_spi_query(), pltcl_SPI_prepare(), PLy_cursor_query(), PLy_spi_prepare(), query_to_xml_and_xmlschema(), query_to_xmlschema(), RI_Initial_Check(), RI_PartitionRemove_Check(), ri_PlanCheck(), test_predtest(), ts_stat_sql(), tsquery_rewrite_query(), and ttdummy().
SPIPlanPtr SPI_prepare_cursor | ( | const char * | src, |
int | nargs, | ||
Oid * | argtypes, | ||
int | cursorOptions | ||
) |
Definition at line 866 of file spi.c.
References _SPI_begin_call(), _SPI_end_call(), _SPI_make_plan_non_temp(), _SPI_PLAN_MAGIC, _SPI_prepare_plan(), plan, RAW_PARSE_DEFAULT, SPI_ERROR_ARGUMENT, and SPI_result.
Referenced by SPI_prepare().
SPIPlanPtr SPI_prepare_extended | ( | const char * | src, |
const SPIPrepareOptions * | options | ||
) |
Definition at line 902 of file spi.c.
References _SPI_begin_call(), _SPI_end_call(), _SPI_make_plan_non_temp(), _SPI_PLAN_MAGIC, _SPI_prepare_plan(), plan, SPI_ERROR_ARGUMENT, and SPI_result.
Referenced by exec_prepare_plan().
SPIPlanPtr SPI_prepare_params | ( | const char * | src, |
ParserSetupHook | parserSetup, | ||
void * | parserSetupArg, | ||
int | cursorOptions | ||
) |
Definition at line 938 of file spi.c.
References _SPI_begin_call(), _SPI_end_call(), _SPI_make_plan_non_temp(), _SPI_PLAN_MAGIC, _SPI_prepare_plan(), plan, RAW_PARSE_DEFAULT, SPI_ERROR_ARGUMENT, and SPI_result.
int SPI_register_relation | ( | EphemeralNamedRelation | enr | ) |
Definition at line 3297 of file spi.c.
References _SPI_begin_call(), _SPI_current, _SPI_end_call(), _SPI_find_ENR_by_name(), create_queryEnv(), EphemeralNamedRelationData::md, EphemeralNamedRelationMetadataData::name, _SPI_connection::queryEnv, register_ENR(), res, SPI_ERROR_ARGUMENT, SPI_ERROR_REL_DUPLICATE, and SPI_OK_REL_REGISTER.
Referenced by SPI_register_trigger_data().
int SPI_register_trigger_data | ( | TriggerData * | tdata | ) |
Definition at line 3364 of file spi.c.
References ENR_NAMED_TUPLESTORE, EphemeralNamedRelationMetadataData::enrtuples, EphemeralNamedRelationMetadataData::enrtype, EphemeralNamedRelationData::md, EphemeralNamedRelationMetadataData::name, palloc(), RelationData::rd_id, EphemeralNamedRelationData::reldata, EphemeralNamedRelationMetadataData::reliddesc, SPI_ERROR_ARGUMENT, SPI_OK_REL_REGISTER, SPI_OK_TD_REGISTER, SPI_register_relation(), TriggerData::tg_newtable, TriggerData::tg_oldtable, TriggerData::tg_relation, TriggerData::tg_trigger, Trigger::tgnewtable, Trigger::tgoldtable, EphemeralNamedRelationMetadataData::tupdesc, and tuplestore_tuple_count().
Referenced by plperl_trigger_handler(), plpgsql_exec_trigger(), plsample_trigger_handler(), pltcl_trigger_handler(), and PLy_exec_trigger().
void* SPI_repalloc | ( | void * | pointer, |
Size | size | ||
) |
const char* SPI_result_code_string | ( | int | code | ) |
Definition at line 1972 of file spi.c.
References buf, SPI_ERROR_ARGUMENT, SPI_ERROR_CONNECT, SPI_ERROR_COPY, SPI_ERROR_NOATTRIBUTE, SPI_ERROR_NOOUTFUNC, SPI_ERROR_OPUNKNOWN, SPI_ERROR_PARAM, SPI_ERROR_REL_DUPLICATE, SPI_ERROR_REL_NOT_FOUND, SPI_ERROR_TRANSACTION, SPI_ERROR_TYPUNKNOWN, SPI_ERROR_UNCONNECTED, SPI_OK_CONNECT, SPI_OK_CURSOR, SPI_OK_DELETE, SPI_OK_DELETE_RETURNING, SPI_OK_FETCH, SPI_OK_FINISH, SPI_OK_INSERT, SPI_OK_INSERT_RETURNING, SPI_OK_MERGE, SPI_OK_MERGE_RETURNING, SPI_OK_REL_REGISTER, SPI_OK_REL_UNREGISTER, SPI_OK_REWRITTEN, SPI_OK_SELECT, SPI_OK_SELINTO, SPI_OK_TD_REGISTER, SPI_OK_UPDATE, SPI_OK_UPDATE_RETURNING, SPI_OK_UTILITY, and sprintf.
Referenced by check_foreign_key(), check_primary_key(), exec_dynquery_with_params(), exec_prepare_plan(), exec_run_select(), exec_stmt_call(), exec_stmt_dynexecute(), exec_stmt_execsql(), exec_stmt_forc(), exec_stmt_open(), exec_stmt_return_query(), plperl_spi_execute_fetch_result(), plperl_spi_prepare(), plperl_spi_query(), plperl_spi_query_prepared(), plpgsql_call_handler(), plpgsql_inline_handler(), plpgsql_validator(), pltcl_process_SPI_result(), PLy_cursor_plan(), PLy_cursor_query(), PLy_spi_execute_plan(), PLy_spi_execute_query(), PLy_spi_prepare(), query_to_oid_list(), RI_Initial_Check(), RI_PartitionRemove_Check(), ri_PerformCheck(), ri_PlanCheck(), and ttdummy().
HeapTupleHeader SPI_returntuple | ( | HeapTuple | tuple, |
TupleDesc | tupdesc | ||
) |
Definition at line 1074 of file spi.c.
References _SPI_current, assign_record_type_typmod(), DatumGetHeapTupleHeader, heap_copy_tuple_as_datum(), MemoryContextSwitchTo(), _SPI_connection::savedcxt, SPI_ERROR_ARGUMENT, SPI_ERROR_UNCONNECTED, SPI_result, TupleDescData::tdtypeid, and TupleDescData::tdtypmod.
Referenced by coerce_function_result_tuple().
void SPI_rollback | ( | void | ) |
Definition at line 413 of file spi.c.
References _SPI_rollback().
Referenced by exec_stmt_rollback(), plperl_spi_rollback(), pltcl_rollback(), and PLy_rollback().
void SPI_rollback_and_chain | ( | void | ) |
Definition at line 419 of file spi.c.
References _SPI_rollback().
Referenced by exec_stmt_rollback().
SPIPlanPtr SPI_saveplan | ( | SPIPlanPtr | plan | ) |
Definition at line 1003 of file spi.c.
References _SPI_begin_call(), _SPI_end_call(), _SPI_PLAN_MAGIC, _SPI_save_plan(), plan, SPI_ERROR_ARGUMENT, and SPI_result.
void SPI_scroll_cursor_fetch | ( | Portal | portal, |
FetchDirection | direction, | ||
long | count | ||
) |
Definition at line 1835 of file spi.c.
References _SPI_cursor_operation(), CreateDestReceiver(), and DestSPI.
Referenced by exec_stmt_fetch().
void SPI_scroll_cursor_move | ( | Portal | portal, |
FetchDirection | direction, | ||
long | count | ||
) |
Definition at line 1850 of file spi.c.
References _SPI_cursor_operation(), and None_Receiver.
Referenced by exec_stmt_fetch().
int SPI_unregister_relation | ( | const char * | name | ) |
Definition at line 3331 of file spi.c.
References _SPI_begin_call(), _SPI_current, _SPI_end_call(), _SPI_find_ENR_by_name(), EphemeralNamedRelationData::md, name, EphemeralNamedRelationMetadataData::name, _SPI_connection::queryEnv, res, SPI_ERROR_ARGUMENT, SPI_ERROR_REL_NOT_FOUND, SPI_OK_REL_UNREGISTER, and unregister_ENR().
|
extern |
Definition at line 44 of file spi.c.
Referenced by _SPI_cursor_operation(), _SPI_execute_plan(), AtEOSubXact_SPI(), AtEOXact_SPI(), build_tuplestore_recursively(), check_foreign_key(), check_primary_key(), crosstab(), cursor_to_xml(), exec_for_query(), exec_run_select(), exec_stmt_call(), exec_stmt_dynexecute(), exec_stmt_execsql(), exec_stmt_fetch(), get_crosstab_tuplestore(), get_tuple_of_interest(), initialize_worker_spi(), load_categories_hash(), pg_get_ruledef_worker(), pg_get_viewdef_worker(), plperl_spi_exec(), plperl_spi_exec_prepared(), plperl_spi_fetchrow(), pltcl_SPI_execute(), pltcl_SPI_execute_plan(), PLy_cursor_fetch(), PLy_cursor_iternext(), PLy_spi_execute_plan(), PLy_spi_execute_query(), query_to_oid_list(), query_to_xml_internal(), refresh_by_match_merge(), RI_Initial_Check(), RI_PartitionRemove_Check(), ri_PerformCheck(), SPI_connect_ext(), SPI_cursor_open_internal(), SPI_finish(), test_predtest(), ts_stat_sql(), tsquery_rewrite_query(), worker_spi_main(), and xpath_table().
|
extern |
Definition at line 46 of file spi.c.
Referenced by AtEOSubXact_SPI(), AtEOXact_SPI(), check_foreign_key(), check_primary_key(), exec_dynquery_with_params(), exec_prepare_plan(), exec_run_select(), exec_stmt_forc(), exec_stmt_open(), plperl_spi_prepare(), plperl_spi_query(), plperl_spi_query_prepared(), PLy_cursor_plan(), PLy_cursor_query(), PLy_spi_prepare(), RI_Initial_Check(), RI_PartitionRemove_Check(), ri_PlanCheck(), SPI_connect_ext(), SPI_copytuple(), SPI_cursor_open_with_args(), SPI_cursor_parse_open(), SPI_finish(), SPI_fname(), SPI_getargcount(), SPI_getargtypeid(), SPI_getbinval(), SPI_gettype(), SPI_gettypeid(), SPI_getvalue(), SPI_is_cursor_plan(), SPI_modifytuple(), SPI_prepare_cursor(), SPI_prepare_extended(), SPI_prepare_params(), SPI_returntuple(), SPI_saveplan(), and ttdummy().
|
extern |
Definition at line 45 of file spi.c.
Referenced by _SPI_cursor_operation(), _SPI_execute_plan(), AtEOSubXact_SPI(), AtEOXact_SPI(), build_tuplestore_recursively(), crosstab(), exec_for_query(), exec_run_select(), exec_stmt_call(), exec_stmt_dynexecute(), exec_stmt_execsql(), exec_stmt_fetch(), get_crosstab_tuplestore(), get_tuple_of_interest(), initialize_worker_spi(), load_categories_hash(), pg_get_ruledef_worker(), pg_get_viewdef_worker(), plperl_spi_exec(), plperl_spi_exec_prepared(), plperl_spi_fetchrow(), pltcl_SPI_execute(), pltcl_SPI_execute_plan(), PLy_cursor_fetch(), PLy_cursor_iternext(), PLy_spi_execute_plan(), PLy_spi_execute_query(), query_to_oid_list(), refresh_by_match_merge(), RI_Initial_Check(), RI_PartitionRemove_Check(), SPI_connect_ext(), SPI_cursor_open_internal(), SPI_finish(), SPI_freetuptable(), SPI_sql_row_to_xmlelement(), test_predtest(), ts_stat_sql(), tsquery_rewrite_query(), worker_spi_main(), and xpath_table().