Reject zero or negative BY step in plpgsql integer FOR-loops, and behave

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 816ff27f60385d362898d8ac6523f043f888b1f5
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2007-07-15T02:15:04Z
Releases: 8.3.0
Reject zero or negative BY step in plpgsql integer FOR-loops, and behave
sanely if the loop value overflows int32 on the way to the end value.
Avoid useless computation of "SELECT 1" when BY is omitted.  Avoid some
type-punning between Datum and int4 that dates from the original coding.

Files

PathChange+/−
src/pl/plpgsql/src/gram.y modified +11 −25
src/pl/plpgsql/src/pl_exec.c modified +52 −28
src/pl/plpgsql/src/pl_funcs.c modified +3 −3
src/pl/plpgsql/src/plpgsql.h modified +2 −2