pgsql: Fix reset of incorrect hash iterator in GROUPING SETS queries

From: David Rowley <drowley(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix reset of incorrect hash iterator in GROUPING SETS queries
Date: 2025-10-18 03:07:57
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix reset of incorrect hash iterator in GROUPING SETS queries

This fixes an unlikely issue when fetching GROUPING SET results from
their internally stored hash tables. It was possible in rare cases that
the hash iterator would be set up incorrectly which could result in a
crash.

This was introduced in 4d143509c, so backpatch to v18.

Many thanks to Yuri Zamyatin for reporting and helping to debug this
issue.

Bug: #19078
Reported-by: Yuri Zamyatin <yuri(at)yrz(dot)am>
Author: David Rowley <dgrowleyml(at)gmail(dot)com>
Reviewed-by: Jeff Davis <pgsql(at)j-davis(dot)com>
Discussion: https://postgr.es/m/[email protected]
Backpatch-through: 18

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/0b6a02f0355c8950ffe22b52eac86f6261e19caf

Modified Files
--------------
src/backend/executor/nodeAgg.c | 2 +-
src/include/lib/simplehash.h | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Álvaro Herrera 2025-10-18 15:54:17 pgsql: Fix pg_dump sorting of foreign key constraints
Previous Message David Rowley 2025-10-18 03:07:33 pgsql: Fix reset of incorrect hash iterator in GROUPING SETS queries