131 const char *name1,
const char *name2,
const char *name3,
135 while (ns_cur != NULL)
140 for (nsitem = ns_cur;
142 nsitem = nsitem->
prev)
144 if (strcmp(nsitem->
name, name1) == 0)
158 strcmp(nsitem->
name, name1) == 0)
160 for (nsitem = ns_cur;
162 nsitem = nsitem->
prev)
164 if (strcmp(nsitem->
name, name2) == 0)
180 ns_cur = nsitem->
prev;
197 while (ns_cur != NULL)
202 ns_cur = ns_cur->
prev;
216 while (ns_cur != NULL)
221 ns_cur = ns_cur->
prev;
234 switch (
stmt->cmd_type)
237 return _(
"statement block");
239 return _(
"assignment");
249 return _(
"FOR with integer loop variable");
251 return _(
"FOR over SELECT rows");
253 return _(
"FOR over cursor");
255 return _(
"FOREACH over array");
261 return "RETURN NEXT";
263 return "RETURN QUERY";
269 return _(
"SQL statement");
273 return _(
"FOR over EXECUTE statement");
276 "GET STACKED DIAGNOSTICS" :
"GET DIAGNOSTICS";
307 return "PG_ROUTINE_OID";
311 return "PG_EXCEPTION_CONTEXT";
313 return "PG_EXCEPTION_DETAIL";
315 return "PG_EXCEPTION_HINT";
317 return "RETURNED_SQLSTATE";
319 return "COLUMN_NAME";
321 return "CONSTRAINT_NAME";
323 return "PG_DATATYPE_NAME";
325 return "MESSAGE_TEXT";
329 return "SCHEMA_NAME";
379 switch (
stmt->cmd_type)
509 foreach(l,
stmt->elsif_list)
525 foreach(l,
stmt->case_when_list)
586 foreach(lc,
stmt->params)
650 foreach(lc,
stmt->params)
661 foreach(lc,
stmt->params)
665 foreach(lc,
stmt->options)
692 foreach(lc,
stmt->params)
705 foreach(lc,
stmt->params)
719 if (expr && expr->
plan)
834 switch (
stmt->cmd_type)
939 if (block->
label == NULL)
959 printf(
" EXCEPTION WHEN ");
994 foreach(l,
stmt->elsif_list)
1025 foreach(l,
stmt->case_when_list)
1039 if (
stmt->have_else)
1082 printf(
"FORI %s %s\n",
stmt->var->refname, (
stmt->reverse) ?
"REVERSE" :
"NORMAL");
1130 if (
stmt->argquery != NULL)
1150 if (
stmt->slice != 0)
1169 if (
stmt->argquery != NULL)
1172 printf(
" arguments = '");
1176 if (
stmt->query != NULL)
1183 if (
stmt->dynquery != NULL)
1200 foreach(lc,
stmt->params)
1203 printf(
" parameter $%d: ",
i++);
1224 if (
stmt->target != NULL)
1227 printf(
" target = %d %s\n",
1228 stmt->target->dno,
stmt->target->refname);
1244 switch (
stmt->direction)
1259 printf(
"??? unknown cursor direction %d",
stmt->direction);
1284 printf(
"PERFORM expr = ");
1293 printf(
"%s expr = ",
stmt->is_call ?
"CALL" :
"DO");
1303 printf(
"COMMIT AND CHAIN\n");
1313 printf(
"ROLLBACK AND CHAIN\n");
1322 printf(
"%s",
stmt->is_exit ?
"EXIT" :
"CONTINUE");
1323 if (
stmt->label != NULL)
1325 if (
stmt->cond != NULL)
1338 if (
stmt->retvarno >= 0)
1340 else if (
stmt->expr != NULL)
1352 if (
stmt->retvarno >= 0)
1354 else if (
stmt->expr != NULL)
1373 printf(
"RETURN QUERY EXECUTE ");
1386 foreach(lc,
stmt->params)
1389 printf(
" parameter $%d: ",
i++);
1412 foreach(lc,
stmt->params)
1415 printf(
" parameter %d: ",
i++);
1424 foreach(lc,
stmt->options)
1447 printf(
" CONSTRAINT = ");
1476 if (
stmt->message != NULL)
1495 if (
stmt->target != NULL)
1498 printf(
" INTO%s target = %d %s\n",
1499 stmt->strict ?
" STRICT" :
"",
1500 stmt->target->dno,
stmt->target->refname);
1514 if (
stmt->target != NULL)
1517 printf(
" INTO%s target = %d %s\n",
1518 stmt->strict ?
" STRICT" :
"",
1519 stmt->target->dno,
stmt->target->refname);
1530 foreach(lc,
stmt->params)
1533 printf(
" parameter %d: ",
i++);
1546 printf(
"FORS %s EXECUTE ",
stmt->var->refname);
1559 foreach(lc,
stmt->params)
1562 printf(
" parameter $%d: ",
i++);
1579 printf(
"GET %s DIAGNOSTICS ",
stmt->is_stacked ?
"STACKED" :
"CURRENT");
1580 foreach(lc,
stmt->diag_items)
1605 printf(
"\nExecution tree of successfully compiled PL/pgSQL function %s:\n",
1608 printf(
"\nFunction's data area:\n");
1621 printf(
"VAR %-16s type %s (typoid %u) atttypmod %d\n",
1663 printf(
"REC %-16s typoid %u\n",
1678 printf(
"RECFIELD %-16s of REC %d\n",
1686 printf(
"\nFunction's statements:\n");
#define Assert(condition)
static void const char fflush(stdout)
void MemoryContextDelete(MemoryContext context)
static ListCell * list_head(const List *l)
static void dump_dynexecute(PLpgSQL_stmt_dynexecute *stmt)
static void dump_return_next(PLpgSQL_stmt_return_next *stmt)
void plpgsql_ns_pop(void)
const char * plpgsql_getdiag_kindname(PLpgSQL_getdiag_kind kind)
static void free_rollback(PLpgSQL_stmt_rollback *stmt)
static void free_assign(PLpgSQL_stmt_assign *stmt)
static void free_return(PLpgSQL_stmt_return *stmt)
static void free_assert(PLpgSQL_stmt_assert *stmt)
static void free_fori(PLpgSQL_stmt_fori *stmt)
static void dump_close(PLpgSQL_stmt_close *stmt)
static void free_getdiag(PLpgSQL_stmt_getdiag *stmt)
static void dump_perform(PLpgSQL_stmt_perform *stmt)
static void dump_if(PLpgSQL_stmt_if *stmt)
static void free_stmts(List *stmts)
static void dump_fetch(PLpgSQL_stmt_fetch *stmt)
void plpgsql_ns_init(void)
static void dump_execsql(PLpgSQL_stmt_execsql *stmt)
static void dump_case(PLpgSQL_stmt_case *stmt)
static void free_forc(PLpgSQL_stmt_forc *stmt)
static void free_fetch(PLpgSQL_stmt_fetch *stmt)
static void dump_open(PLpgSQL_stmt_open *stmt)
static void dump_assign(PLpgSQL_stmt_assign *stmt)
static void dump_stmts(List *stmts)
static void free_while(PLpgSQL_stmt_while *stmt)
static void dump_cursor_direction(PLpgSQL_stmt_fetch *stmt)
void plpgsql_dumptree(PLpgSQL_function *func)
static void free_raise(PLpgSQL_stmt_raise *stmt)
static PLpgSQL_nsitem * ns_top
static void dump_loop(PLpgSQL_stmt_loop *stmt)
const char * plpgsql_stmt_typename(PLpgSQL_stmt *stmt)
static void free_dynexecute(PLpgSQL_stmt_dynexecute *stmt)
static void dump_raise(PLpgSQL_stmt_raise *stmt)
static void dump_rollback(PLpgSQL_stmt_rollback *stmt)
static void free_if(PLpgSQL_stmt_if *stmt)
void plpgsql_free_function_memory(PLpgSQL_function *func)
PLpgSQL_nsitem * plpgsql_ns_find_nearest_loop(PLpgSQL_nsitem *ns_cur)
static void dump_while(PLpgSQL_stmt_while *stmt)
static void dump_expr(PLpgSQL_expr *expr)
static void dump_stmt(PLpgSQL_stmt *stmt)
void plpgsql_ns_additem(PLpgSQL_nsitem_type itemtype, int itemno, const char *name)
static void dump_block(PLpgSQL_stmt_block *block)
static void dump_getdiag(PLpgSQL_stmt_getdiag *stmt)
static void dump_exit(PLpgSQL_stmt_exit *stmt)
static void free_commit(PLpgSQL_stmt_commit *stmt)
static void free_call(PLpgSQL_stmt_call *stmt)
static void free_open(PLpgSQL_stmt_open *stmt)
static void free_case(PLpgSQL_stmt_case *stmt)
static void free_block(PLpgSQL_stmt_block *block)
static void free_fors(PLpgSQL_stmt_fors *stmt)
static void free_execsql(PLpgSQL_stmt_execsql *stmt)
static void dump_call(PLpgSQL_stmt_call *stmt)
static void free_exit(PLpgSQL_stmt_exit *stmt)
static void free_close(PLpgSQL_stmt_close *stmt)
static void dump_forc(PLpgSQL_stmt_forc *stmt)
static void dump_ind(void)
static void free_return_query(PLpgSQL_stmt_return_query *stmt)
PLpgSQL_nsitem * plpgsql_ns_top(void)
static void dump_commit(PLpgSQL_stmt_commit *stmt)
static void free_return_next(PLpgSQL_stmt_return_next *stmt)
static void dump_return(PLpgSQL_stmt_return *stmt)
void plpgsql_ns_push(const char *label, PLpgSQL_label_type label_type)
static void free_expr(PLpgSQL_expr *expr)
static void free_stmt(PLpgSQL_stmt *stmt)
PLpgSQL_nsitem * plpgsql_ns_lookup(PLpgSQL_nsitem *ns_cur, bool localmode, const char *name1, const char *name2, const char *name3, int *names_used)
static void free_foreach_a(PLpgSQL_stmt_foreach_a *stmt)
static void free_loop(PLpgSQL_stmt_loop *stmt)
static void dump_foreach_a(PLpgSQL_stmt_foreach_a *stmt)
static void dump_return_query(PLpgSQL_stmt_return_query *stmt)
static void dump_assert(PLpgSQL_stmt_assert *stmt)
static void dump_dynfors(PLpgSQL_stmt_dynfors *stmt)
static void dump_fori(PLpgSQL_stmt_fori *stmt)
static void dump_fors(PLpgSQL_stmt_fors *stmt)
static void free_dynfors(PLpgSQL_stmt_dynfors *stmt)
static void free_perform(PLpgSQL_stmt_perform *stmt)
PLpgSQL_nsitem * plpgsql_ns_lookup_label(PLpgSQL_nsitem *ns_cur, const char *name)
@ PLPGSQL_STMT_RETURN_QUERY
@ PLPGSQL_STMT_RETURN_NEXT
@ PLPGSQL_STMT_DYNEXECUTE
@ PLPGSQL_RAISEOPTION_COLUMN
@ PLPGSQL_RAISEOPTION_TABLE
@ PLPGSQL_RAISEOPTION_SCHEMA
@ PLPGSQL_RAISEOPTION_CONSTRAINT
@ PLPGSQL_RAISEOPTION_DETAIL
@ PLPGSQL_RAISEOPTION_MESSAGE
@ PLPGSQL_RAISEOPTION_HINT
@ PLPGSQL_RAISEOPTION_ERRCODE
@ PLPGSQL_RAISEOPTION_DATATYPE
@ PLPGSQL_GETDIAG_ERROR_DETAIL
@ PLPGSQL_GETDIAG_SCHEMA_NAME
@ PLPGSQL_GETDIAG_MESSAGE_TEXT
@ PLPGSQL_GETDIAG_DATATYPE_NAME
@ PLPGSQL_GETDIAG_TABLE_NAME
@ PLPGSQL_GETDIAG_CONSTRAINT_NAME
@ PLPGSQL_GETDIAG_COLUMN_NAME
@ PLPGSQL_GETDIAG_ROW_COUNT
@ PLPGSQL_GETDIAG_RETURNED_SQLSTATE
@ PLPGSQL_GETDIAG_CONTEXT
@ PLPGSQL_GETDIAG_ERROR_HINT
@ PLPGSQL_GETDIAG_ERROR_CONTEXT
@ PLPGSQL_GETDIAG_ROUTINE_OID
int SPI_freeplan(SPIPlanPtr plan)
struct PLpgSQL_condition * next
PLpgSQL_getdiag_kind kind
PLpgSQL_condition * conditions
PLpgSQL_stmt_block * action
char name[FLEXIBLE_ARRAY_MEMBER]
struct PLpgSQL_nsitem * prev
PLpgSQL_nsitem_type itemtype
PLpgSQL_raise_option_type opt_type
PLpgSQL_expr * default_val
PLpgSQL_exception_block * exceptions
PLpgSQL_promise_type promise
int cursor_explicit_argrow
PLpgSQL_expr * cursor_explicit_expr
PLpgSQL_expr * default_val