jian he <jian.universal...@gmail.com> writes: > On Mon, Oct 14, 2024 at 1:13 AM Tom Lane <t...@sss.pgh.pa.us> wrote: >> Right, but we might not have entered either of those previous >> if-blocks.
> in src/backend/parser/gram.y > your makeRawStmt changes (v4) seem to guarantee that > RawStmt->stmt_location >= 0. Yes, I would expect that any RawStmt we see here will have valid stmt_location. What you seem to be missing is that an error could be thrown from > raw_parsetree_list = pg_parse_query(sql); before execute_sql_string reaches its loop over RawStmts. In that case we'll reach script_error_callback with callback_arg.stmt_location still being -1. > pg_parse_query(sql) doesn't use script_error_callback. Eh? We've put that on the error context callback stack. It is not pg_parse_query's decision whether it will be called. regards, tom lane