Re: Improper usage of MemoryContext in nodeSubplan.c for buildSubPlanHash() function. This maybe causes allocate memory failed. - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Improper usage of MemoryContext in nodeSubplan.c for buildSubPlanHash() function. This maybe causes allocate memory failed.
Date
Msg-id 3494.1280292939@sss.pgh.pa.us
Whole thread Raw
In response to Re: Improper usage of MemoryContext in nodeSubplan.c for buildSubPlanHash() function. This maybe causes allocate memory failed.  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
I wrote:
> "Tao Ma" <feng_eden@163.com> writes:
>> This is a potential memory error in nodeSubplan.c or execGrouping.c
>> Using select '1'::TEXT IN ((SELECT '1'::NAME) UNION ALL SELECT '1'::NAME);
>> to reproduce this bug.
>> ...
>> To fix this problem, we can use another memory context to passin 
>> BuildTupleHashTable() as the hashtable's tempcxt, or use other memory 
>> context as hash table's tempcxt or other ways.

> Yeah, I think you're right --- we can't get away with reusing the
> innerecontext's per-tuple context for the hashtable temp contexts.
> The best solution is probably to make an additional context that
> does nothing but act as the hashtable temp context.

I've committed a fix along those lines.  Thanks for the report!
        regards, tom lane


pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: PostGIS vs. PGXS in 9.0beta3
Next
From: "Joshua D. Drake"
Date:
Subject: Re: Toward a column reorder solution