Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c3YZh-0008QF-El for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Nov 2016 01:18:13 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1c3YZg-0002BQ-Q0 for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Nov 2016 01:18:12 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1c3YYI-0000dD-V0 for pgsql-hackers@postgreSQL.org; Mon, 07 Nov 2016 01:16:47 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1c3YYG-0006la-NR for pgsql-hackers@postgreSQL.org; Mon, 07 Nov 2016 01:16:45 +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 uA71Gh3F020809 for ; Sun, 6 Nov 2016 20:16:43 -0500 From: Tom Lane To: pgsql-hackers@postgreSQL.org Subject: Let's get rid of SPI_push/SPI_pop MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <20807.1478481403.1@sss.pgh.pa.us> Date: Sun, 06 Nov 2016 20:16:43 -0500 Message-ID: <20808.1478481403@sss.pgh.pa.us> X-Pg-Spam-Score: -3.9 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org The intent of SPI_push/SPI_pop seems to be to draw a boundary line between nested layers of SPI callers. Which is fine, but the SPI_connect and SPI_finish calls of the inner layer would suffice for that. AFAICS, the only thing that SPI_push/SPI_pop buy for us is the ability to detect a missing SPI_connect or SPI_finish in an inner function layer. And that seems pretty useless, because any such bug in a function would be immediately detected in simple testing that calls it without any outer level of SPI calls. As against that, we have the risk of forgotten SPI_push/SPI_pop calls that go undetected for years, as just seen in commit fc8b81a29. We've had that type of bug before too, cf 0d4899e44. And then there's the fact that we put conditional SPI_push/SPI_pop calls into various places, eg deac9488d, which it seems to me largely destroys whatever debugging value the concept did have. So I think we should just delete these functions and adjust SPI_connect and SPI_finish so that they just push/pop a context level unconditionally. (Which will make them simpler, not more complicated.) We can provide do-nothing macros by these names to avoid an API break for third-party extensions. Comments, objections? regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers