Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mShGr-0008FY-6a for pgsql-bugs@arkaria.postgresql.org; Tue, 21 Sep 2021 15:01:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mShGp-00018B-SB for pgsql-bugs@arkaria.postgresql.org; Tue, 21 Sep 2021 15:01:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mShGp-000183-Ld for pgsql-bugs@lists.postgresql.org; Tue, 21 Sep 2021 15:01:19 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mShGn-0005vp-Bm for pgsql-bugs@lists.postgresql.org; Tue, 21 Sep 2021 15:01:19 +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 18LF1BMD1980153; Tue, 21 Sep 2021 11:01:11 -0400 From: Tom Lane To: notegihu@confused.at cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17199: Calling stored procedure with stable function as argument results in wrong result In-reply-to: <17199-1ab2561f0d94af92@postgresql.org> References: <17199-1ab2561f0d94af92@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Tue, 21 Sep 2021 12:52:14 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1980151.1632236471.1@sss.pgh.pa.us> Date: Tue, 21 Sep 2021 11:01:11 -0400 Message-ID: <1980152.1632236471@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > When a function that returns just a row count of a table is marked as STABLE > and is called from a stored procedure as argument, the result of the > function is different than when the function is called beforehand and stored > to a local variable. Ugh. Looks like I broke this in 84f5c2908, by not thinking about the possibility that a CALL's argument expressions would need an up-to-date snapshot. Will fix, thanks for the report! regards, tom lane