1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-16 06:01:02 +03:00

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.
This commit is contained in:
Tom Lane
2009-09-09 03:32:52 +00:00
parent d69a419e68
commit 255f66efa9
9 changed files with 203 additions and 44 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/parse_expr.c,v 1.242 2009/07/16 06:33:43 petere Exp $
* $PostgreSQL: pgsql/src/backend/parser/parse_expr.c,v 1.243 2009/09/09 03:32:52 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -1251,7 +1251,7 @@ transformSubLink(ParseState *pstate, SubLink *sublink)
return result;
pstate->p_hasSubLinks = true;
qtree = parse_sub_analyze(sublink->subselect, pstate);
qtree = parse_sub_analyze(sublink->subselect, pstate, NULL);
/*
* Check that we got something reasonable. Many of these conditions are