Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1scmpM-00ATPa-3s for pgsql-hackers@arkaria.postgresql.org; Sat, 10 Aug 2024 14:12:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1scmpJ-0093Lx-N9 for pgsql-hackers@arkaria.postgresql.org; Sat, 10 Aug 2024 14:12:13 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1scmpJ-0093LE-DE for pgsql-hackers@lists.postgresql.org; Sat, 10 Aug 2024 14:12:13 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1scmpC-00433E-QB for pgsql-hackers@lists.postgresql.org; Sat, 10 Aug 2024 14:12:12 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 47AEC4J23133983; Sat, 10 Aug 2024 10:12:04 -0400 From: Tom Lane To: Stepan cc: pgsql-hackers@lists.postgresql.org Subject: Re: SPI_connect, SPI_connect_ext return type In-reply-to: References: Comments: In-reply-to Stepan message dated "Sat, 10 Aug 2024 16:55:46 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3133981.1723299124.1@sss.pgh.pa.us> Date: Sat, 10 Aug 2024 10:12:04 -0400 Message-ID: <3133982.1723299124@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Stepan writes: > Hi, hackers! If you look at the code in the src/backend/executor/spi.c file, > you will see the SPI_connect function familiar to many there, which > internally simply calls SPI_connect_ext. The return type is int, at the end > it says return SPI_OK_CONNECT; > It confuses me that nothing but OK, judging by the code, can return.(I > understand that earlier, before 1833f1a1, it could also return > SPI_ERROR_CONNECT). Therefore, I suggest making the returned value void > instead of int and not checking the returned value. What do you think about > this? That would break a lot of code (much of it not under our control) to little purpose; it would also foreclose the option to return to using SPI_ERROR_CONNECT someday. We go to a lot of effort to keep the SPI API as stable as we can across major versions, so I don't see why we'd just randomly make an API-breaking change like this. regards, tom lane