Re: Improving PL/Tcl's error context reports

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>, pgsql-hackers@lists.postgresql.org
Date: 2024-07-04T19:42:49Z
Lists: pgsql-hackers

Attachments

I wrote:
> Pavel Stehule <pavel.stehule@gmail.com> writes:
>> PLpgSQL uses more often function signature
>> (2024-07-04 19:49:20) postgres=# select bx(0);
>> ERROR:  division by zero
>> CONTEXT:  PL/pgSQL function fx(integer) line 1 at RETURN
>> PL/pgSQL function bx(integer) line 1 at RETURN

> Oh that's a good idea!  So let's use format_procedure(), same as
> plpgsql does, to generate the final context line that currently
> reads like

> in PL/Tcl function "bogus"

> Then, we could apply the "pull out just alphanumerics" rule to
> the result of format_procedure() to generate the internal Tcl name.
> That should greatly reduce the number of cases where we have duplicate
> internal names we have to unique-ify.

Here's a v2 that does it like that.

			regards, tom lane

Commits

  1. Improve PL/Tcl's method for choosing Tcl names of procedures.

  2. Fix pl/tcl's handling of errors from Tcl_ListObjGetElements().