pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Handle numeric overflow when handling range values
7+ messages / 1 participants
[nested] [flat]

* pgsql: Handle numeric overflow when handling range values
@ 2026-11-05 14:51 Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Tomas Vondra @ 2026-11-05 14:51 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Handle numeric overflow when handling range values

The numrange_subdiff() function was calculating the difference simply by
calling numeric_sub and numeric_float8, but those functions are not
overflow-safe. It's possible to insert valid numeric ranges for which
the difference overflows either numeric or float8.

The overflow may affect various operations on numrange columns. It may
cause failures during ANALYZE on the table, inserts into GiST indexes,
selectivity estimation, and possibly other operations.

Fixed by handling overflows in numrange_subdiff() - extreme differences
are treated as infinity.

Author: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: shihao zhong <zhong950419@gmail.com>
Backpatch-through: 14
Discussion: https://postgr.es/m/CALdSSPgBvXz-VSF0p-5k%3D_uFfN38cWrERmm_AC4K67N6MWQhmg%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d06ac896faa7ff14e6eca5c9bc27a34818adf634

Modified Files
--------------
src/backend/utils/adt/rangetypes.c            | 37 ++++++++++++++++++++++-----
src/test/regress/expected/multirangetypes.out |  7 +++++
src/test/regress/sql/multirangetypes.sql      |  9 +++++++
3 files changed, 46 insertions(+), 7 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Handle numeric overflow when handling range values
@ 2026-11-05 14:51 Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Tomas Vondra @ 2026-11-05 14:51 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Handle numeric overflow when handling range values

The numrange_subdiff() function was calculating the difference simply by
calling numeric_sub and numeric_float8, but those functions are not
overflow-safe. It's possible to insert valid numeric ranges for which
the difference overflows either numeric or float8.

The overflow may affect various operations on numrange columns. It may
cause failures during ANALYZE on the table, inserts into GiST indexes,
selectivity estimation, and possibly other operations.

Fixed by handling overflows in numrange_subdiff() - extreme differences
are treated as infinity.

Author: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: shihao zhong <zhong950419@gmail.com>
Backpatch-through: 14
Discussion: https://postgr.es/m/CALdSSPgBvXz-VSF0p-5k%3D_uFfN38cWrERmm_AC4K67N6MWQhmg%40mail.gmail.com

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/1137ebf22b0d1feb0c61182b81f4aa4779c01195

Modified Files
--------------
src/backend/utils/adt/rangetypes.c            | 37 ++++++++++++++++++++++-----
src/test/regress/expected/multirangetypes.out |  7 +++++
src/test/regress/sql/multirangetypes.sql      |  9 +++++++
3 files changed, 46 insertions(+), 7 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Handle numeric overflow when handling range values
@ 2026-11-05 14:51 Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Tomas Vondra @ 2026-11-05 14:51 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Handle numeric overflow when handling range values

The numrange_subdiff() function was calculating the difference simply by
calling numeric_sub and numeric_float8, but those functions are not
overflow-safe. It's possible to insert valid numeric ranges for which
the difference overflows either numeric or float8.

The overflow may affect various operations on numrange columns. It may
cause failures during ANALYZE on the table, inserts into GiST indexes,
selectivity estimation, and possibly other operations.

Fixed by handling overflows in numrange_subdiff() - extreme differences
are treated as infinity.

Author: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: shihao zhong <zhong950419@gmail.com>
Backpatch-through: 14
Discussion: https://postgr.es/m/CALdSSPgBvXz-VSF0p-5k%3D_uFfN38cWrERmm_AC4K67N6MWQhmg%40mail.gmail.com

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/8a043da94728821e1dfc6758cd883bafb57bfac7

Modified Files
--------------
src/backend/utils/adt/rangetypes.c            | 37 ++++++++++++++++++++++-----
src/test/regress/expected/multirangetypes.out |  7 +++++
src/test/regress/sql/multirangetypes.sql      |  9 +++++++
3 files changed, 46 insertions(+), 7 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Handle numeric overflow when handling range values
@ 2026-11-05 14:51 Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Tomas Vondra @ 2026-11-05 14:51 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Handle numeric overflow when handling range values

The numrange_subdiff() function was calculating the difference simply by
calling numeric_sub and numeric_float8, but those functions are not
overflow-safe. It's possible to insert valid numeric ranges for which
the difference overflows either numeric or float8.

The overflow may affect various operations on numrange columns. It may
cause failures during ANALYZE on the table, inserts into GiST indexes,
selectivity estimation, and possibly other operations.

Fixed by handling overflows in numrange_subdiff() - extreme differences
are treated as infinity.

Author: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: shihao zhong <zhong950419@gmail.com>
Backpatch-through: 14
Discussion: https://postgr.es/m/CALdSSPgBvXz-VSF0p-5k%3D_uFfN38cWrERmm_AC4K67N6MWQhmg%40mail.gmail.com

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/dfd98ce58eae35ae264ccd3ca210a3d574ac5927

Modified Files
--------------
src/backend/utils/adt/rangetypes.c            | 37 ++++++++++++++++++++++-----
src/test/regress/expected/multirangetypes.out |  7 +++++
src/test/regress/sql/multirangetypes.sql      |  9 +++++++
3 files changed, 46 insertions(+), 7 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Handle numeric overflow when handling range values
@ 2026-11-05 14:51 Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Tomas Vondra @ 2026-11-05 14:51 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Handle numeric overflow when handling range values

The numrange_subdiff() function was calculating the difference simply by
calling numeric_sub and numeric_float8, but those functions are not
overflow-safe. It's possible to insert valid numeric ranges for which
the difference overflows either numeric or float8.

The overflow may affect various operations on numrange columns. It may
cause failures during ANALYZE on the table, inserts into GiST indexes,
selectivity estimation, and possibly other operations.

Fixed by handling overflows in numrange_subdiff() - extreme differences
are treated as infinity.

Author: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: shihao zhong <zhong950419@gmail.com>
Backpatch-through: 14
Discussion: https://postgr.es/m/CALdSSPgBvXz-VSF0p-5k%3D_uFfN38cWrERmm_AC4K67N6MWQhmg%40mail.gmail.com

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/5c78685fc2d7402b12bdb10b0d20af31b5cab964

Modified Files
--------------
src/backend/utils/adt/rangetypes.c            | 37 ++++++++++++++++++++++-----
src/test/regress/expected/multirangetypes.out |  7 +++++
src/test/regress/sql/multirangetypes.sql      |  9 +++++++
3 files changed, 46 insertions(+), 7 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Handle numeric overflow when handling range values
@ 2026-11-05 14:51 Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Tomas Vondra @ 2026-11-05 14:51 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Handle numeric overflow when handling range values

The numrange_subdiff() function was calculating the difference simply by
calling numeric_sub and numeric_float8, but those functions are not
overflow-safe. It's possible to insert valid numeric ranges for which
the difference overflows either numeric or float8.

The overflow may affect various operations on numrange columns. It may
cause failures during ANALYZE on the table, inserts into GiST indexes,
selectivity estimation, and possibly other operations.

Fixed by handling overflows in numrange_subdiff() - extreme differences
are treated as infinity.

Author: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: shihao zhong <zhong950419@gmail.com>
Backpatch-through: 14
Discussion: https://postgr.es/m/CALdSSPgBvXz-VSF0p-5k%3D_uFfN38cWrERmm_AC4K67N6MWQhmg%40mail.gmail.com

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/10686da4eddb5f37ecb1a3467c1c411cd1c84003

Modified Files
--------------
src/backend/utils/adt/rangetypes.c            | 37 ++++++++++++++++++++++-----
src/test/regress/expected/multirangetypes.out |  7 +++++
src/test/regress/sql/multirangetypes.sql      |  9 +++++++
3 files changed, 46 insertions(+), 7 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Handle numeric overflow when handling range values
@ 2026-11-05 14:51 Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Tomas Vondra @ 2026-11-05 14:51 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Handle numeric overflow when handling range values

The numrange_subdiff() function was calculating the difference simply by
calling numeric_sub and numeric_float8, but those functions are not
overflow-safe. It's possible to insert valid numeric ranges for which
the difference overflows either numeric or float8.

The overflow may affect various operations on numrange columns. It may
cause failures during ANALYZE on the table, inserts into GiST indexes,
selectivity estimation, and possibly other operations.

Fixed by handling overflows in numrange_subdiff() - extreme differences
are treated as infinity.

Author: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: shihao zhong <zhong950419@gmail.com>
Backpatch-through: 14
Discussion: https://postgr.es/m/CALdSSPgBvXz-VSF0p-5k%3D_uFfN38cWrERmm_AC4K67N6MWQhmg%40mail.gmail.com

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/52f418f1f8acbbe44c3ff267ece6082ee61fff9f

Modified Files
--------------
src/backend/utils/adt/rangetypes.c            | 37 ++++++++++++++++++++++-----
src/test/regress/expected/multirangetypes.out |  7 +++++
src/test/regress/sql/multirangetypes.sql      |  9 +++++++
3 files changed, 46 insertions(+), 7 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2026-11-05 14:51 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-11-05 14:51 pgsql: Handle numeric overflow when handling range values Tomas Vondra <tomas.vondra@postgresql.org>
2026-11-05 14:51 pgsql: Handle numeric overflow when handling range values Tomas Vondra <tomas.vondra@postgresql.org>
2026-11-05 14:51 pgsql: Handle numeric overflow when handling range values Tomas Vondra <tomas.vondra@postgresql.org>
2026-11-05 14:51 pgsql: Handle numeric overflow when handling range values Tomas Vondra <tomas.vondra@postgresql.org>
2026-11-05 14:51 pgsql: Handle numeric overflow when handling range values Tomas Vondra <tomas.vondra@postgresql.org>
2026-11-05 14:51 pgsql: Handle numeric overflow when handling range values Tomas Vondra <tomas.vondra@postgresql.org>
2026-11-05 14:51 pgsql: Handle numeric overflow when handling range values Tomas Vondra <tomas.vondra@postgresql.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox