Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1elLNH-0000X1-3d for pgsql-bugs@arkaria.postgresql.org; Mon, 12 Feb 2018 21:10:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1elLNF-0003nY-Qo for pgsql-bugs@arkaria.postgresql.org; Mon, 12 Feb 2018 21:10:53 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1elLNF-0003nP-LB for pgsql-bugs@lists.postgresql.org; Mon, 12 Feb 2018 21:10:53 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1elLN9-0000NZ-RV for pgsql-bugs@lists.postgresql.org; Mon, 12 Feb 2018 21:10:51 +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 w1CLAhaS014539; Mon, 12 Feb 2018 16:10:44 -0500 From: Tom Lane To: Andrew Gierth cc: pgsql-bugs@lists.postgresql.org, dejan.petrovic@islonline.com Subject: Re: BUG #15060: Row in table not found when using pg function in an expression In-reply-to: <12102.1518466287@sss.pgh.pa.us> References: <151844034484.1446.1721073839109092583@wrigleys.postgresql.org> <876072rphi.fsf@news-spur.riddles.org.uk> <12102.1518466287@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Mon, 12 Feb 2018 15:11:27 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <14537.1518469843.1@sss.pgh.pa.us> Date: Mon, 12 Feb 2018 16:10:43 -0500 Message-ID: <14538.1518469843@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I wrote: > The attached patch makes it better and doesn't seem to break any > regression tests. I'm not sure how nervous I am about unexpected > side-effects ... Oh ... my nervousness was justified. This is no good at all; it'd create the same problem introduced at the client query level by commit d573e239f and later reverted by 532994299, namely that we'd be reading tables using a snapshot acquired before we've acquired locks on said tables. To really fix this complaint, it seems like we'd need to take a snapshot before planning and then a new one after planning, matching what happens in the main query pipeline. That's pretty nasty for performance :-( ... it would more or less double the load on the ProcArray for SPI-heavy applications. One could argue that, since this function is throwing an error, it's not really stable --- that implies a lack of interesting side-effects. I don't find that argument totally convincing, but the price of avoiding the error might be more than we really want to pay. regards, tom lane