postgresql/src
Tom Lane 92e7a53752 Remove inadequate assertion check in CTE inlining.
inline_cte() expected to find exactly as many references to the
target CTE as its cterefcount indicates.  While that should be
accurate for the tree as emitted by the parser, there are some
optimizations that occur upstream of here that could falsify it,
notably removal of unused subquery output expressions.

Trying to make the accounting 100% accurate seems expensive and
doomed to future breakage.  It's not really worth it, because
all this code is protecting is downstream assumptions that every
referenced CTE has a plan.  Let's convert those assertions to
regular test-and-elog just in case there's some actual problem,
and then drop the failing assertion.

Per report from Tomas Vondra (thanks also to Richard Guo for
analysis).  Back-patch to v12 where the faulty code came in.

Discussion: https://postgr.es/m/29196a1e-ed47-c7ca-9be2-b1c636816183@enterprisedb.com
2022-04-21 17:58:52 -04:00
..
backend Remove inadequate assertion check in CTE inlining. 2022-04-21 17:58:52 -04:00
bin Rethink method for assigning OIDs to the template0 and postgres DBs. 2022-04-21 16:23:15 -04:00
common Add missing error handling in pg_md5_hash(). 2022-04-18 20:04:55 -04:00
fe_utils Allow db.schema.table patterns, but complain about random garbage. 2022-04-20 11:37:29 -04:00
include Remove inadequate assertion check in CTE inlining. 2022-04-21 17:58:52 -04:00
interfaces Fix missed cases in libpq's error handling. 2022-04-21 17:12:49 -04:00
makefiles Refactor DLSUFFIX handling 2022-03-25 08:56:02 +01:00
pl Remove extraneous blank lines before block-closing braces 2022-04-13 19:16:02 +02:00
port Remove extraneous blank lines before block-closing braces 2022-04-13 19:16:02 +02:00
template Refactor DLSUFFIX handling 2022-03-25 08:56:02 +01:00
test Remove inadequate assertion check in CTE inlining. 2022-04-21 17:58:52 -04:00
timezone Update copyright for 2022 2022-01-07 19:04:57 -05:00
tools Build libpq test programs under MSVC 2022-04-16 09:36:08 -04:00
tutorial Update copyright for 2022 2022-01-07 19:04:57 -05:00
.gitignore
DEVELOPERS
Makefile Remove the option to build thread_test.c outside configure. 2020-10-21 12:08:48 -04:00
Makefile.global.in Update Unicode data to CLDR 41 2022-04-06 08:17:33 +02:00
Makefile.shlib AIX: Fix missing libpq symbols by respecting SHLIB_EXPORTS. 2021-09-06 11:27:59 -07:00
nls-global.mk Improve frontend error logging style. 2022-04-08 14:55:14 -04:00