BUG #4902: Subquery in VALUES referencing a CTE - Mailing list pgsql-bugs

From Marko Tiikkaja
Subject BUG #4902: Subquery in VALUES referencing a CTE
Date
Msg-id 200907051927.n65JRlWQ018712@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #4902: Subquery in VALUES referencing a CTE  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
The following bug has been logged online:

Bug reference:      4902
Logged by:          Marko Tiikkaja
Email address:      marko.tiikkaja@cs.helsinki.fi
PostgreSQL version: 8.4.0
Operating system:   Linux
Description:        Subquery in VALUES referencing a CTE
Details:

While playing around with common table expressions, I found this:

=> with cte(foo) as ( values(0) ) values((select foo from cte));
ERROR:  XX000: SubPlan found with no parent plan
LOCATION:  ExecInitExpr, execQual.c:4343

In src/backend/executor/nodeValuesscan.c the comment near line 116 says that
subqueries inside VALUES should be initplans, but in this case we get a
SubPlan. Passing node instead of NULL to ExecInitExpr() below gives the
expected output.

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Diffrent column ordering after dump/restore tables with INHERITS
Next
From: Steve Purcell
Date:
Subject: Re: BUG #4901: Column name "window" breaks pg_dump/pg_restore