Skip to content

Commit e31cd67

Browse files
author
Neil Conway
committed
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.
1 parent c186c93 commit e31cd67

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

src/pl/plpgsql/src/pl_funcs.c

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* procedural language
44
*
55
* IDENTIFICATION
6-
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.41 2005/06/10 16:23:11 neilc Exp $
6+
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.42 2005/06/14 00:10:02 neilc Exp $
77
*
88
* This software is copyrighted by Jan Wieck - Hamburg.
99
*
@@ -675,10 +675,12 @@ dump_if(PLpgSQL_stmt_if *stmt)
675675

676676
dump_stmts(stmt->true_body);
677677

678-
dump_ind();
679-
printf(" ELSE\n");
680-
681-
dump_stmts(stmt->false_body);
678+
if (stmt->false_body != NIL)
679+
{
680+
dump_ind();
681+
printf(" ELSE\n");
682+
dump_stmts(stmt->false_body);
683+
}
682684

683685
dump_ind();
684686
printf(" ENDIF\n");
@@ -908,6 +910,18 @@ dump_dynexecute(PLpgSQL_stmt_dynexecute *stmt)
908910
printf("EXECUTE ");
909911
dump_expr(stmt->query);
910912
printf("\n");
913+
914+
dump_indent += 2;
915+
if (stmt->rec != NULL)
916+
{
917+
dump_ind();
918+
printf(" target = %d %s\n", stmt->rec->recno, stmt->rec->refname);
919+
} else if (stmt->row != NULL)
920+
{
921+
dump_ind();
922+
printf(" target = %d %s\n", stmt->row->rowno, stmt->row->refname);
923+
}
924+
dump_indent -= 2;
911925
}
912926

913927
static void
@@ -987,7 +1001,7 @@ plpgsql_dumptree(PLpgSQL_function *func)
9871001
printf("\nExecution tree of successfully compiled PL/pgSQL function %s:\n",
9881002
func->fn_name);
9891003

990-
printf("\nFunctions data area:\n");
1004+
printf("\nFunction's data area:\n");
9911005
for (i = 0; i < func->ndatums; i++)
9921006
{
9931007
d = func->datums[i];
@@ -1062,7 +1076,7 @@ plpgsql_dumptree(PLpgSQL_function *func)
10621076
printf("??? unknown data type %d\n", d->dtype);
10631077
}
10641078
}
1065-
printf("\nFunctions statements:\n");
1079+
printf("\nFunction's statements:\n");
10661080

10671081
dump_indent = 0;
10681082
printf("%3d:", func->action->lineno);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy