pgsql: Fix possible incorrect column reference in ERROR message

From: David Rowley <drowley(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix possible incorrect column reference in ERROR message
Date: 2026-01-08 22:04:56
Message-ID: E1vdy7j-005NUi-2q@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix possible incorrect column reference in ERROR message

When creating a partition for a RANGE partitioned table, the reporting
of errors relating to converting the specified range values into
constant values for the partition key's type could display the name of a
previous partition key column when an earlier range was specified as
MINVALUE or MAXVALUE.

This was caused by the code not correctly incrementing the index that
tracks which partition key the foreach loop was working on after
processing MINVALUE/MAXVALUE ranges.

Fix by using foreach_current_index() to ensure the index variable is
always set to the List element being worked on.

Author: myzhen <zhenmingyang(at)yeah(dot)net>
Reviewed-by: zhibin wang <killerwzb(at)gmail(dot)com>
Discussion: https://postgr.es/m/273cab52.978.19b96fc75e7.Coremail.zhenmingyang@yeah.net
Backpatch-through: 14

Branch
------
REL_14_STABLE

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

Modified Files
--------------
src/backend/parser/parse_utilcmd.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2026-01-09 08:08:42 pgsql: meson: Rename cpp variable to cxx
Previous Message David Rowley 2026-01-08 22:04:28 pgsql: Fix possible incorrect column reference in ERROR message