mirror of
https://github.com/postgres/postgres.git
synced 2026-10-23 13:29:09 +03:00
8ea97ee348d4de725dc73df987f7dd28d755efe2
Commite28cf96e9preprocessed the copies of a query level's PlaceHolderVars that were pushed down into its subqueries in a single walk at the start of subquery_planner. That was wrong in two ways. First, such copies can also be inserted later, when a join alias Var of the outer level is expanded within a LATERAL subquery or a SubLink's subselect and the alias expression contains a PHV. Those copies were never preprocessed, so a SubLink within them survived into the subquery's lateral references or into a SubPlan's argument list, tripping an assertion in identify_current_nestloop_params or failing in cost_qual_eval. Second, when a pushed-down copy directly contains another PHV of the same level, the walk preprocessed the inner one first and then the outer one, so the outer one's preprocessing ran into the SubPlans just created in the inner one and tripped an assertion in flatten_join_alias_vars. To fix, preprocess the copies right after join alias expansion instead: within preprocess_expression, just before SubLinks are turned into SubPlans, and for LATERAL subquery RTEs, right after their aliases are flattened. Preprocessing a copy handles everything within it, including any further copies nested inside its SubLinks, so the walker no longer looks inside a copy. Back-patch to v16, as with commite28cf96e9. Reported-by: Fujii Masao <masao.fujii@gmail.com> Author: Richard Guo <guofenglinux@gmail.com> Discussion: https://postgr.es/m/CAHGQGwH-acRnAk1=Ki4EiAJEt67+Rz=_jyg7pbP_c6BK4oHZ4Q@mail.gmail.com Backpatch-through: 16
PostgreSQL Database Management System ===================================== This directory contains the source code distribution of the PostgreSQL database management system. PostgreSQL is an advanced object-relational database management system that supports an extended subset of the SQL standard, including transactions, foreign keys, subqueries, triggers, user-defined types and functions. This distribution also contains C language bindings. PostgreSQL has many language interfaces, many of which are listed here: https://www.postgresql.org/download/ See the file INSTALL for instructions on how to build and install PostgreSQL. That file also lists supported operating systems and hardware platforms and contains information regarding any other software packages that are required to build or run the PostgreSQL system. Copyright and license information can be found in the file COPYRIGHT. A comprehensive documentation set is included in this distribution; it can be read as described in the installation instructions. The latest version of this software may be obtained at https://www.postgresql.org/download/. For more information look at our web site located at https://www.postgresql.org/.
Languages
C
83.9%
PLpgSQL
6.2%
Perl
5.4%
Yacc
1.2%
Meson
0.7%
Other
2.4%