postgresql/src/backend/rewrite
Tom Lane dff6c77faf Fix incautious CTE matching in rewriteSearchAndCycle().
This function looks for a reference to the recursive WITH CTE,
but it checked only the CTE name not ctelevelsup, so that it could
seize on a lower CTE that happened to have the same name.  This
would result in planner failures later, either weird errors such as
"could not find attribute 2 in subquery targetlist", or crashes
or assertion failures.  The code also merely Assert'ed that it found
a matching entry, which is not guaranteed at all by the parser.

Per bugs #17320 and #17318 from Zhiyong Wu.
Thanks to Kyotaro Horiguchi for investigation.

Discussion: https://postgr.es/m/17320-70e37868182512ab@postgresql.org
Discussion: https://postgr.es/m/17318-2eb65a3a611d2368@postgresql.org
2022-04-23 12:16:12 -04:00
..
Makefile SEARCH and CYCLE clauses 2021-02-01 14:32:51 +01:00
rewriteDefine.c Disallow converting an inheritance child table to a view. 2021-02-06 15:17:01 -05:00
rewriteHandler.c Fix rewriter to set hasModifyingCTE correctly on rewritten queries. 2021-09-08 12:05:43 -04:00
rewriteManip.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
rewriteRemove.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
rewriteSearchCycle.c Fix incautious CTE matching in rewriteSearchAndCycle(). 2022-04-23 12:16:12 -04:00
rewriteSupport.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
rowsecurity.c doc: Improve hyphenation consistency 2021-04-21 08:14:43 +02:00