Re: Better error reporting from extension scripts (Was: Extend ALTER OPERATOR) - Mailing list pgsql-hackers

From jian he
Subject Re: Better error reporting from extension scripts (Was: Extend ALTER OPERATOR)
Date
Msg-id CACJufxEhaR4Tj0gLvVnRuY_Vs=BqY6LbyMZo_0acnKOdnp5ROQ@mail.gmail.com
Whole thread Raw
In response to Re: Better error reporting from extension scripts (Was: Extend ALTER OPERATOR)  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Better error reporting from extension scripts (Was: Extend ALTER OPERATOR)
List pgsql-hackers
On Wed, Oct 9, 2024 at 4:18 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>

> In the attached v4


in the upper code two branch, both will call CleanQuerytext
so in script_error_callback

+ /*
+ * If we have a location (which, as said above, we really always should)
+ * then report a line number to aid in localizing problems in big scripts.
+ */
+ if (location >= 0)
+ {
+ int linenumber = 1;
+
+ for (query = callback_arg->sql; *query; query++)
+ {
+ if (--location < 0)
+ break;
+ if (*query == '\n')
+ linenumber++;
+ }
+ errcontext("extension script file \"%s\", near line %d",
+   lastslash, linenumber);
+ }
+ else
+ errcontext("extension script file \"%s\"", lastslash);


+ /*
+ * If we have a location (which, as said above, we really always should)
+ * then report a line number to aid in localizing problems in big scripts.
+ */
+ if (location >= 0)
so this part will always be true?



pgsql-hackers by date:

Previous
From: Zhang Mingli
Date:
Subject: Re: [BUG FIX] Fix validation of COPY options FORCE_NOT_NULL/FORCE_NULL
Next
From: Vinícius Abrahão
Date:
Subject: Re: Proposal to Enable/Disable Index using ALTER INDEX