PostgreSQL Source Code git master
|
Go to the source code of this file.
Macros | |
#define | plpgsql_statement_tree_walker(s, sw, ew, c) |
#define | S_WALK(st) stmt_callback(st, context) |
#define | E_WALK(ex) expr_callback(ex, context) |
#define | S_LIST_WALK(lst) foreach_ptr(PLpgSQL_stmt, st, lst) S_WALK(st) |
#define | E_LIST_WALK(lst) foreach_ptr(PLpgSQL_expr, ex, lst) E_WALK(ex) |
Typedefs | |
typedef void(* | plpgsql_stmt_walker_callback) (PLpgSQL_stmt *stmt, void *context) |
typedef void(* | plpgsql_expr_walker_callback) (PLpgSQL_expr *expr, void *context) |
Variables | |
static PLpgSQL_nsitem * | ns_top = NULL |
static int | dump_indent |
#define E_LIST_WALK | ( | lst | ) | foreach_ptr(PLpgSQL_expr, ex, lst) E_WALK(ex) |
#define E_WALK | ( | ex | ) | expr_callback(ex, context) |
#define plpgsql_statement_tree_walker | ( | s, | |
sw, | |||
ew, | |||
c | |||
) |
Definition at line 359 of file pl_funcs.c.
#define S_LIST_WALK | ( | lst | ) | foreach_ptr(PLpgSQL_stmt, st, lst) S_WALK(st) |
#define S_WALK | ( | st | ) | stmt_callback(st, context) |
typedef void(* plpgsql_expr_walker_callback) (PLpgSQL_expr *expr, void *context) |
Definition at line 351 of file pl_funcs.c.
typedef void(* plpgsql_stmt_walker_callback) (PLpgSQL_stmt *stmt, void *context) |
Definition at line 349 of file pl_funcs.c.
|
static |
Definition at line 1459 of file pl_funcs.c.
References dump_expr(), dump_ind(), dump_indent, printf, and stmt.
Referenced by dump_stmt().
|
static |
Definition at line 967 of file pl_funcs.c.
References dump_expr(), dump_ind(), printf, and stmt.
Referenced by dump_stmt().
|
static |
Definition at line 926 of file pl_funcs.c.
References PLpgSQL_exception::action, PLpgSQL_stmt_block::body, PLpgSQL_exception::conditions, PLpgSQL_condition::condname, dump_ind(), dump_stmts(), PLpgSQL_exception_block::exc_list, PLpgSQL_stmt_block::exceptions, PLpgSQL_stmt_block::label, lfirst, name, PLpgSQL_condition::next, and printf.
Referenced by dump_stmt(), and plpgsql_dumptree().
|
static |
Definition at line 1281 of file pl_funcs.c.
References dump_expr(), dump_ind(), printf, and stmt.
Referenced by dump_stmt().
|
static |
Definition at line 1006 of file pl_funcs.c.
References dump_expr(), dump_ind(), dump_indent, dump_stmts(), PLpgSQL_case_when::expr, lfirst, printf, stmt, and PLpgSQL_case_when::stmts.
Referenced by dump_stmt().
|
static |
Definition at line 1265 of file pl_funcs.c.
References dump_ind(), printf, and stmt.
Referenced by dump_stmt().
|
static |
Definition at line 1290 of file pl_funcs.c.
References dump_ind(), printf, and stmt.
Referenced by dump_stmt().
|
static |
Definition at line 1231 of file pl_funcs.c.
References dump_expr(), dump_ind(), dump_indent, FETCH_ABSOLUTE, FETCH_BACKWARD, FETCH_FORWARD, FETCH_RELATIVE, printf, and stmt.
Referenced by dump_fetch().
|
static |
Definition at line 1497 of file pl_funcs.c.
References dump_expr(), dump_ind(), dump_indent, i, lfirst, NIL, printf, and stmt.
Referenced by dump_stmt().
|
static |
Definition at line 1534 of file pl_funcs.c.
References dump_expr(), dump_ind(), dump_indent, dump_stmts(), i, lfirst, NIL, printf, and stmt.
Referenced by dump_stmt().
|
static |
Definition at line 1478 of file pl_funcs.c.
References dump_expr(), dump_ind(), dump_indent, printf, and stmt.
Referenced by dump_stmt().
|
static |
Definition at line 1310 of file pl_funcs.c.
References dump_expr(), dump_ind(), printf, and stmt.
Referenced by dump_stmt().
|
static |
Definition at line 1585 of file pl_funcs.c.
References printf, PLpgSQL_expr::query, PLpgSQL_expr::target_is_local, and PLpgSQL_expr::target_param.
Referenced by dump_assert(), dump_assign(), dump_call(), dump_case(), dump_cursor_direction(), dump_dynexecute(), dump_dynfors(), dump_execsql(), dump_exit(), dump_forc(), dump_foreach_a(), dump_fori(), dump_fors(), dump_if(), dump_open(), dump_perform(), dump_raise(), dump_return(), dump_return_next(), dump_return_query(), dump_while(), and plpgsql_dumptree().
|
static |
Definition at line 1205 of file pl_funcs.c.
References dump_cursor_direction(), dump_ind(), dump_indent, printf, and stmt.
Referenced by dump_stmt().
|
static |
Definition at line 1114 of file pl_funcs.c.
References dump_expr(), dump_ind(), dump_indent, dump_stmts(), printf, and stmt.
Referenced by dump_stmt().
|
static |
Definition at line 1137 of file pl_funcs.c.
References dump_expr(), dump_ind(), dump_stmts(), printf, and stmt.
Referenced by dump_stmt().
|
static |
Definition at line 1070 of file pl_funcs.c.
References dump_expr(), dump_ind(), dump_indent, dump_stmts(), printf, and stmt.
Referenced by dump_stmt().
|
static |
Definition at line 1100 of file pl_funcs.c.
References dump_expr(), dump_ind(), dump_stmts(), printf, and stmt.
Referenced by dump_stmt().
|
static |
Definition at line 1565 of file pl_funcs.c.
References dump_ind(), PLpgSQL_diag_item::kind, lfirst, list_head(), plpgsql_getdiag_kindname(), printf, stmt, and PLpgSQL_diag_item::target.
Referenced by dump_stmt().
|
static |
Definition at line 976 of file pl_funcs.c.
References PLpgSQL_if_elsif::cond, dump_expr(), dump_ind(), dump_stmts(), lfirst, NIL, printf, stmt, and PLpgSQL_if_elsif::stmts.
Referenced by dump_stmt().
|
static |
Definition at line 813 of file pl_funcs.c.
References dump_indent, i, and printf.
Referenced by dump_assert(), dump_assign(), dump_block(), dump_call(), dump_case(), dump_close(), dump_commit(), dump_cursor_direction(), dump_dynexecute(), dump_dynfors(), dump_execsql(), dump_exit(), dump_fetch(), dump_forc(), dump_foreach_a(), dump_fori(), dump_fors(), dump_getdiag(), dump_if(), dump_loop(), dump_open(), dump_perform(), dump_raise(), dump_return(), dump_return_next(), dump_return_query(), dump_rollback(), and dump_while().
|
static |
Definition at line 1044 of file pl_funcs.c.
References dump_ind(), dump_stmts(), printf, and stmt.
Referenced by dump_stmt().
|
static |
Definition at line 1154 of file pl_funcs.c.
References dump_expr(), dump_ind(), dump_indent, i, lfirst, NIL, printf, and stmt.
Referenced by dump_stmt().
|
static |
Definition at line 1272 of file pl_funcs.c.
References dump_expr(), dump_ind(), printf, and stmt.
Referenced by dump_stmt().
|
static |
Definition at line 1390 of file pl_funcs.c.
References dump_expr(), dump_ind(), dump_indent, PLpgSQL_raise_option::expr, i, lfirst, PLpgSQL_raise_option::opt_type, PLPGSQL_RAISEOPTION_COLUMN, PLPGSQL_RAISEOPTION_CONSTRAINT, PLPGSQL_RAISEOPTION_DATATYPE, PLPGSQL_RAISEOPTION_DETAIL, PLPGSQL_RAISEOPTION_ERRCODE, PLPGSQL_RAISEOPTION_HINT, PLPGSQL_RAISEOPTION_MESSAGE, PLPGSQL_RAISEOPTION_SCHEMA, PLPGSQL_RAISEOPTION_TABLE, printf, and stmt.
Referenced by dump_stmt().
|
static |
Definition at line 1325 of file pl_funcs.c.
References dump_expr(), dump_ind(), printf, and stmt.
Referenced by dump_stmt().
|
static |
Definition at line 1339 of file pl_funcs.c.
References dump_expr(), dump_ind(), printf, and stmt.
Referenced by dump_stmt().
|
static |
Definition at line 1353 of file pl_funcs.c.
References dump_expr(), dump_ind(), dump_indent, i, lfirst, NIL, printf, and stmt.
Referenced by dump_stmt().
|
static |
Definition at line 1300 of file pl_funcs.c.
References dump_ind(), printf, and stmt.
Referenced by dump_stmt().
|
static |
Definition at line 822 of file pl_funcs.c.
References dump_assert(), dump_assign(), dump_block(), dump_call(), dump_case(), dump_close(), dump_commit(), dump_dynexecute(), dump_dynfors(), dump_execsql(), dump_exit(), dump_fetch(), dump_forc(), dump_foreach_a(), dump_fori(), dump_fors(), dump_getdiag(), dump_if(), dump_loop(), dump_open(), dump_perform(), dump_raise(), dump_return(), dump_return_next(), dump_return_query(), dump_rollback(), dump_while(), elog, ERROR, 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, printf, and stmt.
Referenced by dump_stmts().
|
static |
Definition at line 915 of file pl_funcs.c.
References dump_indent, dump_stmt(), and lfirst.
Referenced by dump_block(), dump_case(), dump_dynfors(), dump_forc(), dump_foreach_a(), dump_fori(), dump_fors(), dump_if(), dump_loop(), and dump_while().
|
static |
Definition at line 1056 of file pl_funcs.c.
References dump_expr(), dump_ind(), dump_stmts(), printf, and stmt.
Referenced by dump_stmt().
|
static |
Definition at line 706 of file pl_funcs.c.
References PLpgSQL_expr::plan, and SPI_freeplan().
Referenced by free_stmt(), and plpgsql_free_function_memory().
|
static |
Definition at line 698 of file pl_funcs.c.
References free_expr(), free_stmt(), plpgsql_statement_tree_walker, and stmt.
Referenced by free_stmt(), and plpgsql_free_function_memory().
|
static |
Definition at line 662 of file pl_funcs.c.
References bms_is_member(), PLpgSQL_expr::target_is_local, and PLpgSQL_expr::target_param.
Referenced by mark_stmt().
|
static |
Definition at line 623 of file pl_funcs.c.
References bms_add_member(), bms_copy(), bms_free(), PLpgSQL_stmt_block::exceptions, i, PLpgSQL_stmt_block::initvarnos, mark_expr(), mark_stmt(), PLpgSQL_stmt_block::n_initvars, plpgsql_statement_tree_walker, PLPGSQL_STMT_BLOCK, and stmt.
Referenced by mark_stmt(), and plpgsql_mark_local_assignment_targets().
void plpgsql_dumptree | ( | PLpgSQL_function * | func | ) |
Definition at line 1594 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, 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(), and plpgsql_compile_inline().
void plpgsql_free_function_memory | ( | PLpgSQL_function * | func | ) |
Definition at line 716 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_expr(), free_stmt(), 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_mark_local_assignment_targets | ( | PLpgSQL_function * | func | ) |
Definition at line 673 of file pl_funcs.c.
References PLpgSQL_function::action, bms_add_member(), bms_free(), PLpgSQL_function::fn_argvarnos, PLpgSQL_function::fn_nargs, i, and mark_stmt().
Referenced by do_compile(), and plpgsql_compile_inline().
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().
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().
|
static |
Definition at line 364 of file pl_funcs.c.
References PLpgSQL_stmt_forc::argquery, PLpgSQL_stmt_open::argquery, PLpgSQL_stmt_block::body, PLpgSQL_stmt_loop::body, PLpgSQL_stmt_while::body, PLpgSQL_stmt_fori::body, PLpgSQL_stmt_fors::body, PLpgSQL_stmt_forc::body, PLpgSQL_stmt_dynfors::body, PLpgSQL_stmt_foreach_a::body, PLpgSQL_stmt_case::case_when_list, PLpgSQL_stmt_while::cond, PLpgSQL_stmt_exit::cond, PLpgSQL_stmt_assert::cond, PLpgSQL_stmt_open::dynquery, PLpgSQL_stmt_return_query::dynquery, E_LIST_WALK, E_WALK, elog, PLpgSQL_stmt_case::else_stmts, ERROR, PLpgSQL_exception_block::exc_list, PLpgSQL_stmt_block::exceptions, PLpgSQL_stmt_assign::expr, PLpgSQL_stmt_perform::expr, PLpgSQL_stmt_call::expr, PLpgSQL_stmt_foreach_a::expr, PLpgSQL_stmt_fetch::expr, PLpgSQL_stmt_return::expr, PLpgSQL_stmt_return_next::expr, foreach_ptr, ifstmt, PLpgSQL_stmt_fori::lower, PLpgSQL_stmt_assert::message, PLpgSQL_stmt_raise::options, PLpgSQL_stmt_dynfors::params, PLpgSQL_stmt_open::params, PLpgSQL_stmt_return_query::params, PLpgSQL_stmt_raise::params, PLpgSQL_stmt_dynexecute::params, 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, PLpgSQL_stmt_fors::query, PLpgSQL_stmt_dynfors::query, PLpgSQL_stmt_open::query, PLpgSQL_stmt_return_query::query, PLpgSQL_stmt_dynexecute::query, S_LIST_WALK, PLpgSQL_stmt_execsql::sqlstmt, PLpgSQL_stmt_fori::step, stmt, PLpgSQL_stmt_case::t_expr, and PLpgSQL_stmt_fori::upper.
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().
|
static |
Definition at line 777 of file pl_funcs.c.
Referenced by dump_assert(), dump_case(), dump_cursor_direction(), dump_dynexecute(), dump_dynfors(), dump_execsql(), dump_fetch(), dump_forc(), dump_fori(), dump_ind(), dump_open(), dump_raise(), dump_return_query(), dump_stmts(), and plpgsql_dumptree().
|
static |
Definition at line 35 of file pl_funcs.c.
Referenced by plpgsql_ns_additem(), plpgsql_ns_init(), plpgsql_ns_pop(), and plpgsql_ns_top().