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 1sEDLy-000FXS-68 for pgsql-general@arkaria.postgresql.org; Mon, 03 Jun 2024 19:28:23 +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 1sEDLy-00CUCh-0g for pgsql-general@arkaria.postgresql.org; Mon, 03 Jun 2024 19:28:22 +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 1sEDLx-00CUCY-LI for pgsql-general@lists.postgresql.org; Mon, 03 Jun 2024 19:28:21 +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 1sEDLn-003II2-QJ for pgsql-general@postgresql.org; Mon, 03 Jun 2024 19:28:20 +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 453JSAWw090053; Mon, 3 Jun 2024 15:28:10 -0400 From: Tom Lane To: Victor Yegorov cc: Pierre Forstmann , pgsql-general Subject: Re: Unexpected results from CALL and AUTOCOMMIT=off In-reply-to: References: Comments: In-reply-to Victor Yegorov message dated "Mon, 03 Jun 2024 21:15:07 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <90051.1717442890.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 03 Jun 2024 15:28:10 -0400 Message-ID: <90052.1717442890@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Victor Yegorov writes: > =D0=BF=D0=BD, 3 =D0=B8=D1=8E=D0=BD. 2024=E2=80=AF=D0=B3. =D0=B2 20:40, P= ierre Forstmann : >> If you remove stable from function declaration, it works as expected: > ... therefore I assume STABLE should work in this case. Well, it seems n= ot > to. I agree that this looks like a bug, since your example shows that the same function works as-expected in an ordinary expression but not in a CALL. The dependency on AUTOCOMMIT (that is, being within an outer transaction block) seems even odder. I've not dug into it yet, but I suppose we're passing the wrong snapshot to the CALL arguments. A volatile function wouldn't use that snapshot, explaining Pierre's result. regards, tom lane