Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id C0A378B63D7 for ; Wed, 20 Jun 2012 03:34:23 -0300 (ADT) Received: from szxga02-in.huawei.com ([119.145.14.65]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1ShEUf-0004mP-2G for pgsql-bugs@postgresql.org; Wed, 20 Jun 2012 06:34:22 +0000 Received: from 172.24.2.119 (EHLO szxeml202-edg.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.1.9-GA FastPath queued) with ESMTP id AKR09494; Wed, 20 Jun 2012 14:33:50 +0800 (CST) Received: from SZXEML401-HUB.china.huawei.com (10.82.67.31) by szxeml202-edg.china.huawei.com (172.24.2.42) with Microsoft SMTP Server (TLS) id 14.1.323.3; Wed, 20 Jun 2012 14:33:42 +0800 Received: from blrprnc09ns (10.18.96.98) by szxeml401-hub.china.huawei.com (10.82.67.31) with Microsoft SMTP Server id 14.1.323.3; Wed, 20 Jun 2012 14:33:48 +0800 From: Amit Kapila To: "'Heikki Linnakangas'" , CC: References: <4FE072E7.2010000@enterprisedb.com> In-Reply-To: <4FE072E7.2010000@enterprisedb.com> Subject: Re: BUG #6698: sub-query with join producing out of memory in where clause Date: Wed, 20 Jun 2012 12:03:47 +0530 Message-ID: <003801cd4eae$a63e01d0$f2ba0570$@kapila@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: Ac1OGJr7Do20Ve4ISqCIs5JzRxEA+AAkFkUg Content-Language: en-us X-Originating-IP: [10.18.96.98] X-CFilter-Loop: Reflected X-Pg-Spam-Score: -0.9 (/) X-Archive-Number: 201206/170 X-Sequence-Number: 33397 > I'm not sure what the correct fix is. I suppose we could pfree() the = old=20 > value before overwriting it, but I'm not sure if that's safe, or if=20 > there might still be references to the old value somewhere in the = executor. It will resolve the current problem but I am also not sure whether it = can create any other problem because in this function most of the work is done in = per-query memory context. One thing if we can clarify that why per-tuple memory context is not = sufficient for this value than it can be easy to conclude on solution for this problem.=20 Another thing I have noticed is that in function ExecScanSubPlan, the = similar work is not done in Per-query memory context, I am not sure if it is of any relevance for = the problem you mentioned. With Regards, Amit Kapila.