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 1sdUKQ-00G1FM-QF for pgsql-hackers@arkaria.postgresql.org; Mon, 12 Aug 2024 12:39:15 +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 1sdUKP-00Fm7r-FT for pgsql-hackers@arkaria.postgresql.org; Mon, 12 Aug 2024 12:39: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 1sdUKN-00Fm7j-ST for pgsql-hackers@lists.postgresql.org; Mon, 12 Aug 2024 12:39:13 +0000 Received: from fhigh1-smtp.messagingengine.com ([103.168.172.152]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sdUKK-004LhD-Ls for pgsql-hackers@lists.postgresql.org; Mon, 12 Aug 2024 12:39:10 +0000 Received: from phl-compute-03.internal (phl-compute-03.nyi.internal [10.202.2.43]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 1A6C4114017B; Mon, 12 Aug 2024 08:39:07 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by phl-compute-03.internal (MEProxy); Mon, 12 Aug 2024 08:39:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eisentraut.org; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=fm2; t=1723466347; x=1723552747; bh=mcpk0WhAIn4nPmMGBWoy+IIcCSDC/fbg 19LntqS1CA4=; b=y0TSIZHOPF/D6rOCGhAviTK9ggpjt0zVZ/Cr4vmjUvIBD/Xc SLDNm274BgYs0iuLtlt3us0VrI50uPV/uxg7Z52MfRsCQVG3PhCPNnLRkr5kbX5F /svKG8D4OhnaIK3Qa41Wm/I5hHML5lJwDPR1HIom8VmiMpyvmciX48NSC7+EXe7g KtITTKklHHbygPOfRLl6S0S4kGYrTtQEuHWmeRKulGVo46ILg6f8lg7mYE99/0wK xh4qok28MgMeptssnQmEb6L+cTkUz5LvecGx15oE+bWGUM2Q/U1ZR5MAofB4MIK1 oaIThnI5K8SkDnKTjB1VatQEwJaSrobPjaxNkw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1723466347; x= 1723552747; bh=mcpk0WhAIn4nPmMGBWoy+IIcCSDC/fbg19LntqS1CA4=; b=X Olk6b5zFtXA6l7hHavBoi8qBZZ+9n4PYTc6/I0k1d09yujKy7tDvA9JUVMYaglM7 OnLBW/3GppuoL5/uOvvrw8c0W+gkPNAzPZVh9YR5TwefOWWtoFxIxRF0m5TcWCCq JhmZG2bVkn5z9HUYfoFfj+R1abYmL4MOfuNHSfeCRbqidDQkIMSE8yDvAfVGMYar atyaa52AEvnMdluUgb51KM/qDncj13juba49XY0jn8xNH4jmT/Lb8eK9kfNw45NR SClJhKQ1Gb9kRnpyUS3H9pL9cKpKZmARDdLzfg7/pajaeV7zrijBhk5MrCzxyxeR dM/4eq6/m96pTbvzD8PWg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddruddttddgheegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefkffggfg fuvfevfhfhjggtgfesthejredttddvjeenucfhrhhomheprfgvthgvrhcugfhishgvnhht rhgruhhtuceophgvthgvrhesvghishgvnhhtrhgruhhtrdhorhhgqeenucggtffrrghtth gvrhhnpeeljedtudfggffffefhieetfeehtedukeejuedtlefhgefgffdujeehueefudff keenucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgnecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepphgvthgvrhesvghishgvnhhtrhgr uhhtrdhorhhgpdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhuthdprhgtph htthhopehtghhlsehsshhsrdhpghhhrdhprgdruhhspdhrtghpthhtohepshhnuggtphhp ghesghhmrghilhdrtghomhdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgvrhhssehlih hsthhsrdhpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: ie0a040ee:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 12 Aug 2024 08:39:05 -0400 (EDT) Message-ID: Date: Mon, 12 Aug 2024 14:39:04 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: SPI_connect, SPI_connect_ext return type To: Tom Lane , Stepan Cc: pgsql-hackers@lists.postgresql.org References: <3133982.1723299124@sss.pgh.pa.us> Content-Language: en-US From: Peter Eisentraut In-Reply-To: <3133982.1723299124@sss.pgh.pa.us> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 10.08.24 16:12, Tom Lane wrote: > 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. Here is a previous discussion: https://www.postgresql.org/message-id/flat/1356682025.20017.4.camel%40vanquo.pezone.net I like the idea that we would keep the API but convert most errors to exceptions.