]> granicus.if.org Git - postgresql/commitdiff
Prevent #option dump from crashing on FORI statement with null step. Reported by...
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 17 Feb 2010 01:48:58 +0000 (01:48 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 17 Feb 2010 01:48:58 +0000 (01:48 +0000)
src/pl/plpgsql/src/pl_funcs.c

index dd2841e10ed330c5d37d0ae3b9d71b8c0fa0e5b6..1f1f1560e46ebe2e74c4455e70e9da09f024c004 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.67 2008/01/01 19:46:00 momjian Exp $
+ *       $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.67.2.1 2010/02/17 01:48:58 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -749,10 +749,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);