pgsql: Add overflow checks to int4 and int8 versions of generate_series

From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Add overflow checks to int4 and int8 versions of generate_series
Date: 2011-06-17 18:37:26
Message-ID: E1QXdv4-00026h-3S@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add overflow checks to int4 and int8 versions of generate_series().

The previous code went into an infinite loop after overflow. In fact,
an overflow is not really an error; it just means that the current
value is the last one we need to return. So, just arrange to stop
immediately when overflow is detected.

Back-patch all the way.

Branch
------
REL8_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/f49b2eab23199229a322745b6480692056070301

Modified Files
--------------
src/backend/utils/adt/int.c | 4 ++++
src/backend/utils/adt/int8.c | 4 ++++
2 files changed, 8 insertions(+), 0 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2011-06-17 21:40:09 Re: pgsql: Define FLEXIBLE_ARRAY_MEMBER for MSVC.
Previous Message Robert Haas 2011-06-17 17:37:12 pgsql: Fix crash in CREATE UNLOGGED TABLE.