From: Neil Conway Date: Tue, 14 Jun 2005 00:10:02 +0000 (+0000) Subject: Cleanup for "#option dump" in PL/PgSQL: don't print empty ELSE blocks, X-Git-Tag: REL8_1_0BETA1~574 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e31cd6739ae078dc3679467a105fc60272b22e4c;p=thirdparty%2Fpostgresql.git 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. --- diff --git a/src/pl/plpgsql/src/pl_funcs.c b/src/pl/plpgsql/src/pl_funcs.c index 9e2ef4902c2..21d8d9b7f7d 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);