From 711804fddd54ea3c20d32c4b53d05a8c59bcbe4f Mon Sep 17 00:00:00 2001 From: Tom Lane <tgl@sss.pgh.pa.us> Date: Wed, 17 Feb 2010 01:48:45 +0000 Subject: [PATCH] Prevent #option dump from crashing on FORI statement with null step. Reported by Pavel. --- src/pl/plpgsql/src/pl_funcs.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/pl/plpgsql/src/pl_funcs.c b/src/pl/plpgsql/src/pl_funcs.c index a8d0664b204..57334523b4c 100644 --- a/src/pl/plpgsql/src/pl_funcs.c +++ b/src/pl/plpgsql/src/pl_funcs.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.88 2010/01/19 01:35:31 tgl Exp $ + * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.89 2010/02/17 01:48:45 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -543,10 +543,13 @@ dump_fori(PLpgSQL_stmt_fori *stmt) printf(" upper = "); dump_expr(stmt->upper); printf("\n"); - dump_ind(); - printf(" step = "); - dump_expr(stmt->step); - printf("\n"); + if (stmt->step) + { + dump_ind(); + printf(" step = "); + dump_expr(stmt->step); + printf("\n"); + } dump_indent -= 2; dump_stmts(stmt->body); -- GitLab