diff options
| author | Tom Lane | 2010-07-28 04:50:50 +0000 |
|---|---|---|
| committer | Tom Lane | 2010-07-28 04:50:50 +0000 |
| commit | 133924e13e004db8979424bf5436e21b0a09a069 (patch) | |
| tree | 873e884862ef6b7aa849d42cf2b6aa7227b70b17 /src/test | |
| parent | 4ff9c8dd48b265d925be8bf90ac65c34a249c7b5 (diff) | |
Fix potential failure when hashing the output of a subplan that produces
a pass-by-reference datatype with a nontrivial projection step.
We were using the same memory context for the projection operation as for
the temporary context used by the hashtable routines in execGrouping.c.
However, the hashtable routines feel free to reset their temp context at
any time, which'd lead to destroying input data that was still needed.
Report and diagnosis by Tao Ma.
Back-patch to 8.1, where the problem was introduced by the changes that
allowed us to work with "virtual" tuples instead of materializing intermediate
tuple values everywhere. The earlier code looks quite similar, but it doesn't
suffer the problem because the data gets copied into another context as a
result of having to materialize ExecProject's output tuple.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/expected/subselect.out | 9 | ||||
| -rw-r--r-- | src/test/regress/sql/subselect.sql | 6 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/test/regress/expected/subselect.out b/src/test/regress/expected/subselect.out index e839ad7f964..7f8c05bc800 100644 --- a/src/test/regress/expected/subselect.out +++ b/src/test/regress/expected/subselect.out @@ -521,3 +521,12 @@ from ----- (0 rows) +-- +-- Test case for premature memory release during hashing of subplan output +-- +select '1'::text in (select '1'::name union all select '1'::name); + ?column? +---------- + t +(1 row) + diff --git a/src/test/regress/sql/subselect.sql b/src/test/regress/sql/subselect.sql index f6657fa535c..9d13c39c8ab 100644 --- a/src/test/regress/sql/subselect.sql +++ b/src/test/regress/sql/subselect.sql @@ -335,3 +335,9 @@ from from int8_tbl) sq0 join int4_tbl i4 on dummy = i4.f1; + +-- +-- Test case for premature memory release during hashing of subplan output +-- + +select '1'::text in (select '1'::name union all select '1'::name); |
