From e31cd6739ae078dc3679467a105fc60272b22e4c Mon Sep 17 00:00:00 2001 From: Neil Conway Date: Tue, 14 Jun 2005 00:10:02 +0000 Subject: [PATCH] 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. --- src/pl/plpgsql/src/pl_funcs.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/src/pl/plpgsql/src/pl_funcs.c b/src/pl/plpgsql/src/pl_funcs.c index 9e2ef4902c..21d8d9b7f7 100644 --- a/src/pl/plpgsql/src/pl_funcs.c +++ b/src/pl/plpgsql/src/pl_funcs.c @@ -3,7 +3,7 @@ * procedural language * * 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. * @@ -675,10 +675,12 @@ dump_if(PLpgSQL_stmt_if *stmt) dump_stmts(stmt->true_body); - dump_ind(); - printf(" ELSE\n"); - - dump_stmts(stmt->false_body); + if (stmt->false_body != NIL) + { + dump_ind(); + printf(" ELSE\n"); + dump_stmts(stmt->false_body); + } dump_ind(); printf(" ENDIF\n"); @@ -908,6 +910,18 @@ dump_dynexecute(PLpgSQL_stmt_dynexecute *stmt) printf("EXECUTE "); dump_expr(stmt->query); 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 @@ -987,7 +1001,7 @@ plpgsql_dumptree(PLpgSQL_function *func) printf("\nExecution tree of successfully compiled PL/pgSQL function %s:\n", func->fn_name); - printf("\nFunctions data area:\n"); + printf("\nFunction's data area:\n"); for (i = 0; i < func->ndatums; i++) { d = func->datums[i]; @@ -1062,7 +1076,7 @@ plpgsql_dumptree(PLpgSQL_function *func) printf("??? unknown data type %d\n", d->dtype); } } - printf("\nFunctions statements:\n"); + printf("\nFunction's statements:\n"); dump_indent = 0; printf("%3d:", func->action->lineno); -- 2.40.0