pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: jian he <jian.universality@gmail.com>
Cc: Pavel Stehule <pavel.stehule@gmail.com>
Cc: Christoph Berg <myon@debian.org>
Cc: Michael Banck <mbanck@gmx.net>
Cc: Tommy Pavlicek <tommypav122@gmail.com>
Cc: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Better error reporting from extension scripts (Was: Extend ALTER OPERATOR)
Date: Mon, 14 Oct 2024 12:45:27 -0400
Message-ID: <3748500.1728924327@sss.pgh.pa.us> (raw)
In-Reply-To: <CACJufxGBmvy=Z_8stp-YOnbWXWEEEi5CVeSPy49Ex=gDpyoX=w@mail.gmail.com>
References: <CAEhP-W_1bMTLan2LtzS+xr=b-Wep56gw+OoirABQ8b2aOw+5yg@mail.gmail.com>
	<ZTfL1G1fBPQHVPWV@msg.df7cb.de>
	<560086.1698160614@sss.pgh.pa.us>
	<ZTfjXzOKFI9AawJF@msg.df7cb.de>
	<570833.1698162135@sss.pgh.pa.us>
	<66f33840.050a0220.1f9e60.7fb9@mx.google.com>
	<ZvV1ClhnbJLCz7Sm@msg.df7cb.de>
	<325394.1727365907@sss.pgh.pa.us>
	<ZvaiS57G10dITjQm@msg.df7cb.de>
	<571930.1727454668@sss.pgh.pa.us>
	<Zvbr5zv78AfhB83S@msg.df7cb.de>
	<621972.1727459684@sss.pgh.pa.us>
	<1092841.1727552736@sss.pgh.pa.us>
	<2245576.1728418678@sss.pgh.pa.us>
	<CACJufxEhaR4Tj0gLvVnRuY_Vs=BqY6LbyMZo_0acnKOdnp5ROQ@mail.gmail.com>
	<CAFj8pRALVX8XDY9uZz_JCqd8k5VQjMLk3eGc=STonhMvJoLCSw@mail.gmail.com>
	<3482022.1728839631@sss.pgh.pa.us>
	<CACJufxGBmvy=Z_8stp-YOnbWXWEEEi5CVeSPy49Ex=gDpyoX=w@mail.gmail.com>

jian he <jian.universality@gmail.com> writes:
> On Mon, Oct 14, 2024 at 1:13 AM Tom Lane <tgl@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





view thread (27+ messages)  latest in thread

Message-ID: <3748500.1728924327@sss.pgh.pa.us>
Permalink:  ../3748500.1728924327@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3748500.1728924327@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, jian.universality@gmail.com, pavel.stehule@gmail.com, myon@debian.org, mbanck@gmx.net, tommypav122@gmail.com, ilmari@ilmari.org, pgsql-hackers@lists.postgresql.org
  Subject: Re: Better error reporting from extension scripts (Was: Extend ALTER OPERATOR)
  In-Reply-To: <3748500.1728924327@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox