Andres Freund <and...@anarazel.de> 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