Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ePD3O-0004yG-Uo for pgsql-hackers@arkaria.postgresql.org; Wed, 13 Dec 2017 19:50: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 1ePD3O-0002QH-2c for pgsql-hackers@arkaria.postgresql.org; Wed, 13 Dec 2017 19:50:54 +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 1ePD3N-0002Q8-SR for pgsql-hackers@lists.postgresql.org; Wed, 13 Dec 2017 19:50: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 1ePD3F-0007Os-H4 for pgsql-hackers@lists.postgresql.org; Wed, 13 Dec 2017 19:50:53 +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 vBDJoejk007450; Wed, 13 Dec 2017 14:50:40 -0500 From: Tom Lane To: Robert Haas cc: pgsql-hackers@lists.postgresql.org Subject: Re: Inconsistency in plpgsql's error context reports In-reply-to: References: <31545.1512924904@sss.pgh.pa.us> <16763.1513014382@sss.pgh.pa.us> <20970.1513025521@sss.pgh.pa.us> Comments: In-reply-to Robert Haas message dated "Tue, 12 Dec 2017 09:06:04 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <7448.1513194640.1@sss.pgh.pa.us> Date: Wed, 13 Dec 2017 14:50:40 -0500 Message-ID: <7449.1513194640@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Robert Haas writes: > On Mon, Dec 11, 2017 at 3:52 PM, Tom Lane wrote: >> Here's a quick hack at that. I guess the main question that needs to be >> asked is whether we're happy with plpgsql getting so much chattier >> (as per all the regression test changes). > I confess to never having really grokked, even in the pre-patch state, > why we sometimes get an "SQL statement" context line and sometimes > not. However, what strikes me about this is that the SQL statement is > a completely fabricated one that the user never entered. I spent a brief amount of time looking at whether we could hide the "fabricated statements" more thoroughly, and decided that it would be a lot more work than seems warranted, and there would likely be holes in it anyway. It's not like we don't document this behavior: the plpgsql introductory material says All expressions used in PL/pgSQL statements are processed using the server's main SQL executor. For example, when you write a PL/pgSQL statement like IF expression THEN ... PL/pgSQL will evaluate the expression by feeding a query like SELECT expression to the main SQL engine. https://www.postgresql.org/docs/devel/static/plpgsql-expressions.html So basically my conclusion at this point is that I'm not willing to do any more work on this than the patch I already proposed. If you want to do something more invasive, have at it. regards, tom lane