mirror of
https://github.com/postgres/postgres.git
synced 2025-04-25 21:42:33 +03:00
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 :-(
This commit is contained in:
parent
f82e2baef6
commit
426292663a
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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);
|
Assert(variable->varno != OUTER);
|
||||||
slot = econtext->ecxt_scantuple;
|
slot = econtext->ecxt_scantuple;
|
||||||
|
|
||||||
tuple = slot->tts_tuple;
|
tuple = ExecFetchSlotTuple(slot);
|
||||||
tupleDesc = slot->tts_tupleDescriptor;
|
tupleDesc = slot->tts_tupleDescriptor;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -431,3 +431,24 @@ SELECT p.name, p.age FROM person* p ORDER BY age using >, name;
|
|||||||
mary | 8
|
mary | 8
|
||||||
(58 rows)
|
(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;
|
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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user