postgresql/src/backend/optimizer/path
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
..
Makefile Split all OBJS style lines in makefiles into one-line-per-entry style. 2019-11-05 14:41:07 -08:00
allpaths.c Remove inadequate assertion check in CTE inlining. 2022-04-21 17:58:52 -04:00
clausesel.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
costsize.c Fix various typos and spelling mistakes in code comments 2022-04-11 20:49:41 +12:00
equivclass.c Fix comments with "a expression" 2022-03-31 15:45:25 -04:00
indxpath.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
joinpath.c Correct type of front_pathkey to PathKey 2022-01-23 03:53:18 +01:00
joinrels.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
pathkeys.c Fix various typos and spelling mistakes in code comments 2022-04-11 20:49:41 +12:00
tidpath.c Update copyright for 2022 2022-01-07 19:04:57 -05:00