Reject zero or negative BY step in plpgsql integer FOR-loops, and behave
Tom Lane <tgl@sss.pgh.pa.us>
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
| Path | Change | +/− |
|---|---|---|
| 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 |