Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hnBZO-0001ca-W9 for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Jul 2019 00:43:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hnBZN-00039U-SI for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Jul 2019 00:43:49 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hnBZN-00034Q-3E for pgsql-hackers@lists.postgresql.org; Tue, 16 Jul 2019 00:43:49 +0000 Received: from anastigmatix.net ([68.171.219.55]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1hnBZK-0000fs-Tl for pgsql-hackers@postgresql.org; Tue, 16 Jul 2019 00:43:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=anastigmatix.net; s=default; h=Content-Transfer-Encoding:Content-Type: MIME-Version:Date:Message-ID:Subject:From:To:Sender:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=iTF9O0H47ocwpzWX0iaZ9wx6+B8fzATtQqPj6PeFQmQ=; b=jWw5cnCMlpAW4EWrU8FLGLGVh3 nEqyqemmRcdx9vQw52c2o/7n0FSdOXRV0ToMmNbn1Oq5qANUmMFlnCNS4m2TsBighutwb/vTwcH1b J1BoyCDU5mIyeDkb3IHjnNUIzYjMk4H00zG6sdIHAZ9eK9rCpJQdLTBulXylJJn2Fty8ngoCuwxUL uI3O6dOinYaY0v71MPI/d8CgEmVDsIXit0uuGgFOGMM8L8/OCmgaCETL7n62HjzQw5hZ+UMeIg08O OHtxGpx+7ELT+5aFUGj0aYb3l8fkdDsHsbGV2ODyuyw12yxdumNaFnE+3re7Mbi4J0SJbA7ZXMSHP il7Amp5Q==; Received: from [184.19.31.139] (port=38079) by bay.acenet.us with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92) (envelope-from ) id 1hnBZI-003Ey5-C2 for pgsql-hackers@postgresql.org; Mon, 15 Jul 2019 20:43:45 -0400 To: PostgreSQL Hackers From: Chapman Flack Subject: doesn't execSRF.c do that already? X-Enigmail-Draft-Status: N1110 Message-ID: <5D2D1DBF.60103@anastigmatix.net> Date: Mon, 15 Jul 2019 20:43:43 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-OutGoing-Spam-Status: No, score=-96.8 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bay.acenet.us X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - anastigmatix.net X-Get-Message-Sender-Via: bay.acenet.us: authenticated_id: chap@anastigmatix.net X-Authenticated-Sender: bay.acenet.us: chap@anastigmatix.net X-Source: X-Source-Args: X-Source-Dir: X-From-Rewrite: unmodified, already matched List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I see some code of long standing in PL/Java where its handler for a set-returning function creates a new context, "PL/Java row context", during first-call init, as a child of context->multi_call_memory_ctx, diligently resets it with every percall-setup and before calling the user function, and deletes it when the whole set has been returned. The more I look at it, the more convinced I am that this is one hundred percent redundant with what ExecMakeTableFunctionResult is already doing with ecxt_per_tuple_memory, which is similarly reset before every call for a tuple, and is already current when PL/Java's handler is called. Am I missing some obvious reason Thomas might have used his own context for that? As far as I can see in git, ExecMakeTableFunctionResult has been providing its own ecxt_per_tuple_memory, at least as far back as 7.3, which I think is (slightly) older than PL/Java. Regards, -Chap