Fix bug with WITH RECURSIVE immediately inside WITH RECURSIVE. 99% of the
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 9 Sep 2009 03:32:52 +0000 (03:32 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 9 Sep 2009 03:32:52 +0000 (03:32 +0000)
commitcb3965da10c6451fdb41d5f33706af88393776b0
tree3ac49e7a59ad30430f95d6deeb86ec78dd5cc464
parent5f69e9a3788f95c22d26e8de5fef4d5e02bce1af
Fix bug with WITH RECURSIVE immediately inside WITH RECURSIVE.  99% of the
code was already okay with this, but the hack that obtained the output
column types of a recursive union in advance of doing real parse analysis
of the recursive union forgot to handle the case where there was an inner
WITH clause available to the non-recursive term.  Best fix seems to be to
refactor so that we don't need the "throwaway" parse analysis step at all.
Instead, teach the transformSetOperationStmt code to set up the CTE's output
column information after it's processed the non-recursive term normally.
Per report from David Fetter.
src/backend/parser/analyze.c
src/backend/parser/parse_clause.c
src/backend/parser/parse_cte.c
src/backend/parser/parse_expr.c
src/include/parser/analyze.h
src/include/parser/parse_cte.h
src/include/parser/parse_node.h
src/test/regress/expected/with.out
src/test/regress/sql/with.sql