postgresql/src/include
Dean Rasheed 79c65b9d97 Fix parsing of parenthesised OLD/NEW in RETURNING list.
When parsing expressions like (old).colname and (old).* in a RETURNING
list, the parser would lose track of the intended varreturningtype,
and therefore return incorrect results.

The root cause was code using GetNSItemByRangeTablePosn() to find a
namespace item from its rtindex and levelsup, without taking into
account returningtype, which would return the wrong namespace item.
Fix by adding a new function GetNSItemByVar() that does take
returningtype into account.

Backpatch to v18, where support for RETURNING OLD/NEW was added.

Bug: #19516
Reported-by: Marko Grujic <markoog@gmail.com>
Author: Marko Grujic <markoog@gmail.com>
Suggested-by: Dean Rasheed <dean.a.rasheed@gmail.com>
Reviewed-by: Dean Rasheed <dean.a.rasheed@gmail.com>
Discussion: https://postgr.es/m/CAOvwyF2cO_5mAt=w=y-dFnaG5UkZ+3H8nSDoKF_iuWZHsU2ARg@mail.gmail.com
Backpatch-through: 18
2026-06-11 12:08:47 +01:00
..
access Fix calculation of members_size in pg_get_multixact_stats() 2026-05-26 13:49:04 +09:00
archive Update copyright for 2026 2026-01-01 13:24:10 -05:00
backup Pre-beta mechanical code beautification, step 1: run pgindent. 2026-05-13 10:34:17 -04:00
bootstrap Reduce header inclusions via execnodes.h 2026-03-16 14:34:57 +01:00
catalog Record dependencies on graph labels and properties 2026-06-09 12:55:47 +02:00
commands Disallow direct use of the pgrepack logical decoding plugin 2026-06-09 20:12:55 +02:00
common Don't accept length of -1 in pg_locale.h APIs. 2026-05-15 11:09:15 -07:00
datatype Update copyright for 2026 2026-01-01 13:24:10 -05:00
executor Revert "Enable fast default for domains with non-volatile constraints" 2026-06-08 14:20:39 -04:00
fe_utils Pre-beta mechanical code beautification, step 1: run pgindent. 2026-05-13 10:34:17 -04:00
foreign Add support for importing statistics from remote servers. 2026-04-08 19:15:00 +09:00
jit Pre-beta mechanical code beautification, step 1: run pgindent. 2026-05-13 10:34:17 -04:00
lib Pre-beta mechanical code beautification, step 1: run pgindent. 2026-05-13 10:34:17 -04:00
libpq Set notice receiver before libpq connection startup completes 2026-05-23 00:25:48 +09:00
mb Remove MULE_INTERNAL encoding. 2026-04-08 17:40:06 +12:00
nodes Fix FOR PORTION OF for inheritance children 2026-06-08 19:18:58 +02:00
optimizer Pre-beta mechanical code beautification, step 1: run pgindent. 2026-05-13 10:34:17 -04:00
parser Fix parsing of parenthesised OLD/NEW in RETURNING list. 2026-06-11 12:08:47 +01:00
partitioning Update copyright for 2026 2026-01-01 13:24:10 -05:00
pch Update copyright for 2026 2026-01-01 13:24:10 -05:00
port Remove support for 8 byte tear free read/write on 32-bit 2026-05-18 08:59:59 -07:00
portability pg_test_timing: Show additional TSC clock source debug info 2026-05-16 11:51:34 -04:00
postmaster Fix syslogger NULL-pointer-dereference in EXEC_BACKEND 2026-06-08 19:49:54 +02:00
regex Harden our regex engine against integer overflow in size calculations. 2026-05-11 05:13:46 -07:00
replication Disable logical decoding after REPACK (CONCURRENTLY) 2026-05-27 20:11:29 +02:00
rewrite Fix bogus calls in remove_self_join_rel() 2026-04-27 10:40:37 +09:00
snowball Update to latest Snowball sources. 2026-01-05 15:22:37 -05:00
statistics Add support for importing statistics from remote servers. 2026-04-08 19:15:00 +09:00
storage Revert "Allow logical replication snapshots to be database-specific" 2026-05-23 21:33:19 -07:00
tcop Avoid blocking indefinitely while finishing walsender shutdown 2026-05-01 12:12:44 +09:00
tsearch Pre-beta mechanical code beautification, step 1: run pgindent. 2026-05-13 10:34:17 -04:00
utils Fix missed checks for hashability of container-type equality. 2026-06-08 11:48:16 -04:00
.gitignore Use <stdint.h> and <inttypes.h> for c.h integers. 2024-12-04 15:05:38 +13:00
c.h Ensure USE_AVX... symbols are not defined if not building for x86_64. 2026-06-04 10:37:25 -04:00
fmgr.h Pre-beta mechanical code beautification, step 1: run pgindent. 2026-05-13 10:34:17 -04:00
funcapi.h Remove bits* typedefs. 2026-03-30 16:12:08 -05:00
getopt_long.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
Makefile Fix build inconsistency due to the generation of wait-event code 2026-02-02 08:02:39 +09:00
meson.build Ensure that all three build methods install the same set of files. 2026-02-16 15:20:15 -05:00
miscadmin.h Revert "Allow logical replication snapshots to be database-specific" 2026-05-23 21:33:19 -07:00
pg_config.h.in Add errdetail() with PID and UID about source of termination signal. 2026-04-07 10:22:33 -04:00
pg_config_manual.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
pg_getopt.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
pg_trace.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
pgstat.h Fix double-free in pg_stat_autovacuum_scores. 2026-04-09 13:07:06 -05:00
pgtar.h Harden astreamer tar parsing logic against archives it can't handle. 2026-04-02 12:20:36 -04:00
pgtime.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
port.h Pre-beta mechanical code beautification, step 1: run pgindent. 2026-05-13 10:34:17 -04:00
postgres.h Pre-beta mechanical code beautification, step 1: run pgindent. 2026-05-13 10:34:17 -04:00
postgres_ext.h Move pg_int64 back to postgres_ext.h 2025-09-16 10:48:56 +02:00
postgres_fe.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
varatt.h Improve type handling of varlena structures 2026-02-11 07:33:24 +09:00
windowapi.h Update copyright for 2026 2026-01-01 13:24:10 -05:00