Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eYKT2-000511-VD for pgsql-hackers@arkaria.postgresql.org; Sun, 07 Jan 2018 23:35:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eYKT2-00076J-8p for pgsql-hackers@arkaria.postgresql.org; Sun, 07 Jan 2018 23:35:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eYKT2-000768-2E for pgsql-hackers@lists.postgresql.org; Sun, 07 Jan 2018 23:35:04 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eYKSy-0003qt-RD for pgsql-hackers@postgresql.org; Sun, 07 Jan 2018 23:35:03 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w07NYnaw002245; Sun, 7 Jan 2018 18:34:49 -0500 From: Tom Lane To: Andres Freund cc: Dmitry Dolgov <9erthalion6@gmail.com>, Michael Paquier , Arthur Zakirov , Oleg Bartunov , Peter Eisentraut , David Steele , PostgreSQL-development Subject: Re: [HACKERS] [PATCH] Generic type subscripting In-reply-to: <20180107232030.wwanjyrauviqthze@alap3.anarazel.de> References: <20171116114016.GA21162@zakirov.localdomain> <20171119151350.GA23853@arthur.localdomain> <8809.1515031526@sss.pgh.pa.us> <5571.1515364740@sss.pgh.pa.us> <20180107232030.wwanjyrauviqthze@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Sun, 07 Jan 2018 15:20:30 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2243.1515368089.1@sss.pgh.pa.us> Date: Sun, 07 Jan 2018 18:34:49 -0500 Message-ID: <2244.1515368089@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andres Freund writes: > On 2018-01-07 17:39:00 -0500, Tom Lane wrote: >> Now on the other hand, maybe the right way to go is to embrace a similar >> approach to what I did for plpgsql param eval, and let the datatype >> control what gets generated as the expression execution step. > I'll note that I'm not convinced that the goal this paragraph states and > having the datatype control the entire expression step are full > dependent on each other. It seems quite possible to have > ExecInitSubscriptingRef() call a datatype specific function that returns > C callbacks. Yeah, that's a good point. We could define the compile support function as simply being allowed to examine the expression tree and give back the address of the callback function to use, with the rest of the compiled expression structure being predetermined. The more general approach would only be useful if you imagine some sort of high-performance extension that wants to compile specialized expr steps for its subscripting activity. Probably the need for that is pretty far away yet. BTW, if you wanted to change the way plpgsql param callbacks work to be like this design (ie push the actual generation of the ExprStep back into core, with plpgsql just supplying a callback address), I wouldn't object. regards, tom lane