Commit 42629266 authored by Tom Lane's avatar Tom Lane

Fix problem with whole-row Vars referencing sub-select outputs, per

example from Jim Dew.  Add some simple regression tests, since this is
an area we seem to break regularly :-(
parent f82e2bae
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.185 2005/11/22 18:17:10 momjian Exp $
* $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.186 2005/12/14 16:28:32 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -523,7 +523,7 @@ ExecEvalWholeRowVar(ExprState *exprstate, ExprContext *econtext,
Assert(variable->varno != OUTER);
slot = econtext->ecxt_scantuple;
tuple = slot->tts_tuple;
tuple = ExecFetchSlotTuple(slot);
tupleDesc = slot->tts_tupleDescriptor;
/*
......
......@@ -431,3 +431,24 @@ SELECT p.name, p.age FROM person* p ORDER BY age using >, name;
mary | 8
(58 rows)
--
-- Test some cases involving whole-row Var referencing a subquery
--
select foo from (select 1) as foo;
foo
-----
(1)
(1 row)
select foo from (select null) as foo;
foo
-----
()
(1 row)
select foo from (select 'xyzzy',1,null) as foo;
foo
------------
(xyzzy,1,)
(1 row)
......@@ -104,3 +104,9 @@ SELECT p.name, p.age FROM person* p;
--
SELECT p.name, p.age FROM person* p ORDER BY age using >, name;
--
-- Test some cases involving whole-row Var referencing a subquery
--
select foo from (select 1) as foo;
select foo from (select null) as foo;
select foo from (select 'xyzzy',1,null) as foo;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment