Re: plpgsql FOR loop doesn't guard against strange step values

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: plpgsql FOR loop doesn't guard against strange step values
Date: 2007-07-14 20:33:22
Message-ID: 200707142233.22579.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> I just noticed that when the BY option was added to plpgsql FOR
> loops, no real error checking was done.  If you specify a zero step
> value, you'll have an infinite loop.  If you specify a negative
> value, the loop variable will increment in the "wrong direction"
> until integer overflow occurs.  Neither of these behaviors seem
> desirable in the least.

That seems to be fairly normal proramming language behavior.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-07-14 21:13:26 plpgsql and qualified variable names
Previous Message Tom Lane 2007-07-14 18:27:31 plpgsql FOR loop doesn't guard against strange step values