]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix possible incorrect column reference in ERROR message
authorDavid Rowley <drowley@postgresql.org>
Thu, 8 Jan 2026 22:02:59 +0000 (11:02 +1300)
committerDavid Rowley <drowley@postgresql.org>
Thu, 8 Jan 2026 22:02:59 +0000 (11:02 +1300)
commitc35e5dd9ae972393338b81a2427ab4e587f18534
treea65991b190c6da5fbb57328e726f9d52094d7725
parent6c99c715ddb338e169c2ffd2a4cf754fa510cccb
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@yeah.net>
Reviewed-by: zhibin wang <killerwzb@gmail.com>
Discussion: https://postgr.es/m/273cab52.978.19b96fc75e7.Coremail.zhenmingyang@yeah.net
Backpatch-through: 14
src/backend/parser/parse_utilcmd.c