Re: Improving PL/Tcl's error context reports - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Improving PL/Tcl's error context reports
Date
Msg-id 30397.1720116985@sss.pgh.pa.us
Whole thread Raw
In response to Re: Improving PL/Tcl's error context reports  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: Improving PL/Tcl's error context reports
List pgsql-hackers
Pavel Stehule <pavel.stehule@gmail.com> writes:
> Getting unique name based on suffix _oid looks not too much nice (using
> _increment can be nicer), but it should to work

Hmm, yeah we could do an increment.  It'd make the results in cases
of conflict invocation-order-dependent though, which seems like it
might be worse than using OIDs.

> 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.

> Is there some size limit for variable name? I didn't find it.

I did a quick test with 10000-character names and Tcl didn't
complain, so it seems like there's no hard limit.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Said Assemlal
Date:
Subject: Update platform notes to build Postgres on macos
Next
From: Tom Lane
Date:
Subject: Re: PostgreSQL does not compile on macOS SDK 15.0