Commit e31cd673 authored by Neil Conway's avatar Neil Conway

Cleanup for "#option dump" in PL/PgSQL: don't print empty ELSE blocks,

fix two grammatical errors, and print the INTO target of EXECUTE INTO
if one is specified.
parent c186c931
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* procedural language * procedural language
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.41 2005/06/10 16:23:11 neilc Exp $ * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.42 2005/06/14 00:10:02 neilc Exp $
* *
* This software is copyrighted by Jan Wieck - Hamburg. * This software is copyrighted by Jan Wieck - Hamburg.
* *
...@@ -675,10 +675,12 @@ dump_if(PLpgSQL_stmt_if *stmt) ...@@ -675,10 +675,12 @@ dump_if(PLpgSQL_stmt_if *stmt)
dump_stmts(stmt->true_body); dump_stmts(stmt->true_body);
dump_ind(); if (stmt->false_body != NIL)
printf(" ELSE\n"); {
dump_ind();
dump_stmts(stmt->false_body); printf(" ELSE\n");
dump_stmts(stmt->false_body);
}
dump_ind(); dump_ind();
printf(" ENDIF\n"); printf(" ENDIF\n");
...@@ -908,6 +910,18 @@ dump_dynexecute(PLpgSQL_stmt_dynexecute *stmt) ...@@ -908,6 +910,18 @@ dump_dynexecute(PLpgSQL_stmt_dynexecute *stmt)
printf("EXECUTE "); printf("EXECUTE ");
dump_expr(stmt->query); dump_expr(stmt->query);
printf("\n"); printf("\n");
dump_indent += 2;
if (stmt->rec != NULL)
{
dump_ind();
printf(" target = %d %s\n", stmt->rec->recno, stmt->rec->refname);
} else if (stmt->row != NULL)
{
dump_ind();
printf(" target = %d %s\n", stmt->row->rowno, stmt->row->refname);
}
dump_indent -= 2;
} }
static void static void
...@@ -987,7 +1001,7 @@ plpgsql_dumptree(PLpgSQL_function *func) ...@@ -987,7 +1001,7 @@ plpgsql_dumptree(PLpgSQL_function *func)
printf("\nExecution tree of successfully compiled PL/pgSQL function %s:\n", printf("\nExecution tree of successfully compiled PL/pgSQL function %s:\n",
func->fn_name); func->fn_name);
printf("\nFunctions data area:\n"); printf("\nFunction's data area:\n");
for (i = 0; i < func->ndatums; i++) for (i = 0; i < func->ndatums; i++)
{ {
d = func->datums[i]; d = func->datums[i];
...@@ -1062,7 +1076,7 @@ plpgsql_dumptree(PLpgSQL_function *func) ...@@ -1062,7 +1076,7 @@ plpgsql_dumptree(PLpgSQL_function *func)
printf("??? unknown data type %d\n", d->dtype); printf("??? unknown data type %d\n", d->dtype);
} }
} }
printf("\nFunctions statements:\n"); printf("\nFunction's statements:\n");
dump_indent = 0; dump_indent = 0;
printf("%3d:", func->action->lineno); printf("%3d:", func->action->lineno);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment