postgresql/src
Tom Lane 81a12a4477 Fix "failed to find plan for subquery/CTE" errors in EXPLAIN.
To deparse a reference to a field of a RECORD-type output of a
subquery, EXPLAIN normally digs down into the subquery's plan to try
to discover exactly which anonymous RECORD type is meant.  However,
this can fail if the subquery has been optimized out of the plan
altogether on the grounds that no rows could pass the WHERE quals,
which has been possible at least since 3fc6e2d7f.  There isn't
anything remaining in the plan tree that would help us, so fall back
to printing the field name as "fN" for the N'th column of the record.
(This will actually be the right thing some of the time, since it
matches the column names we assign to RowExprs.)

In passing, fix a comment typo in create_projection_plan, which
I noticed while experimenting with an alternative fix for this.

Per bug #18576 from Vasya B.  Back-patch to all supported branches.

Richard Guo and Tom Lane

Discussion: https://postgr.es/m/18576-9feac34e132fea9e@postgresql.org
2024-08-09 11:21:39 -04:00
..
backend Fix "failed to find plan for subquery/CTE" errors in EXPLAIN. 2024-08-09 11:21:39 -04:00
bin Fix pg_rewind debug output to print the source timeline history 2024-08-08 10:21:12 +03:00
common Make fallback MD5 implementation thread-safe on big-endian systems 2024-08-07 10:44:00 +03:00
fe_utils Fix PL/pgSQL's handling of integer ranges containing underscores. 2024-06-04 11:48:01 +01:00
include Restrict accesses to non-system views and foreign tables during pg_dump. 2024-08-05 06:05:30 -07:00
interfaces Revert ECPG's use of pnstrdup() 2024-08-08 07:41:02 +02:00
makefiles Optimize pg_popcount() with AVX-512 instructions. 2024-04-06 21:56:23 -05:00
pl Fix edge case in plpgsql's make_callstmt_target(). 2024-08-07 12:54:39 -04:00
port Pre-beta mechanical code beautification. 2024-05-14 16:34:50 -04:00
template Remove AIX support 2024-02-28 15:17:23 +04:00
test Fix "failed to find plan for subquery/CTE" errors in EXPLAIN. 2024-08-09 11:21:39 -04:00
timezone Update time zone data files to tzdata release 2024a. 2024-02-01 15:57:53 -05:00
tools ci: Pin MacPorts version to 2.9.3. 2024-07-25 14:48:18 +12:00
tutorial Update copyright for 2024 2024-01-03 20:49:05 -05:00
.gitignore
DEVELOPERS
Makefile Remove distprep 2023-11-06 15:18:04 +01:00
Makefile.global.in Update Unicode data to CLDR 45 2024-04-22 09:16:33 +02:00
Makefile.shlib Remove AIX support 2024-02-28 15:17:23 +04:00
meson.build Update copyright for 2024 2024-01-03 20:49:05 -05:00
nls-global.mk Remove distprep 2023-11-06 15:18:04 +01:00