pgsql: Fix potential failure when hashing the output of a subplan that - Mailing list pgsql-committers

From tgl@postgresql.org (Tom Lane)
Subject pgsql: Fix potential failure when hashing the output of a subplan that
Date
Msg-id 20100728045050.848B47541D5@cvs.postgresql.org
Whole thread Raw
List pgsql-committers
Log Message:
-----------
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.

Modified Files:
--------------
    pgsql/src/backend/executor:
        nodeSubplan.c (r1.102 -> r1.103)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/executor/nodeSubplan.c?r1=1.102&r2=1.103)
    pgsql/src/include/nodes:
        execnodes.h (r1.219 -> r1.220)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/nodes/execnodes.h?r1=1.219&r2=1.220)
    pgsql/src/test/regress/expected:
        subselect.out (r1.24 -> r1.25)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/subselect.out?r1=1.24&r2=1.25)
    pgsql/src/test/regress/sql:
        subselect.sql (r1.16 -> r1.17)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/sql/subselect.sql?r1=1.16&r2=1.17)

pgsql-committers by date:

Previous
From: petere@postgresql.org (Peter Eisentraut)
Date:
Subject: pgsql: Show psql timing output even in quiet mode These two settings
Next
From: tgl@postgresql.org (Tom Lane)
Date:
Subject: pgsql: Fix potential failure when hashing the output of a subplan that