Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1goJ9A-00062H-64 for pgsql-hackers@arkaria.postgresql.org; Tue, 29 Jan 2019 02:29:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1goJ99-0006JE-1f for pgsql-hackers@arkaria.postgresql.org; Tue, 29 Jan 2019 02:29:07 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1goJ98-0006J5-Qp for pgsql-hackers@lists.postgresql.org; Tue, 29 Jan 2019 02:29:06 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1goJ96-0005Kl-Pd for pgsql-hackers@postgresql.org; Tue, 29 Jan 2019 02:29:06 +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 x0T2SmhX004140; Mon, 28 Jan 2019 21:28:48 -0500 From: Tom Lane To: Andres Freund cc: Alexander Korotkov , Nikita Glukhov , Tomas Vondra , Oleg Bartunov , Michael Paquier , Stas Kelvich , PostgreSQL-development , Thomas Munro , David Steele , Andrew Dunstan , Robert Haas , Pavel Stehule Subject: Re: jsonpath In-reply-to: <20190129015927.yyywhbt57xwvux7n@alap3.anarazel.de> References: <9f5f1247-29f4-17cd-edd9-38e9bcd95b14@postgrespro.ru> <20190129010332.i4t64evqc3bwtjzx@alap3.anarazel.de> <20190129013115.btqiip2leypmuf3n@alap3.anarazel.de> <20190129015927.yyywhbt57xwvux7n@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Mon, 28 Jan 2019 17:59:27 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4138.1548728928.1@sss.pgh.pa.us> Date: Mon, 28 Jan 2019 21:28:48 -0500 Message-ID: <4139.1548728928@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andres Freund writes: > And even if you, to address Tom's point about plpgsql, had a category > that could only be thrown by core code, Actually, that wasn't quite what my point was there. Even if the error that is thrown is perfectly safe and was thrown from a known spot in the core code, elog.c will call ErrorContextCallback functions on the way out, *before* longjmp'ing back to your code. So, if PL foo executes a SQL command that includes jsonpath operations, it's possible for PL foo's error context reporting code to break whatever assumptions you thought were safe to make. Admittedly, a wise PL designer would refrain from assuming too much about what they can get away with doing in an error context callback. But that very same caution should persuade us not to assume too much about what actually has happened during error processing. regards, tom lane