pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Improving PL/Tcl's error context reports
Date: Thu, 04 Jul 2024 14:16:25 -0400
Message-ID: <30397.1720116985@sss.pgh.pa.us> (raw)
In-Reply-To: <CAFj8pRD4fCxsRGoV3z73cefPoE4GU-W4ORaVK5VNVTpw3PyjKg@mail.gmail.com>
References: <890581.1717609350@sss.pgh.pa.us>
	<974c2531-536a-4223-a264-166872386459@iki.fi>
	<CAFj8pRBTgCHRacAeygUaLCwggARX5Pxqvs+puduiUuRdx9sYHw@mail.gmail.com>
	<26372.1720114586@sss.pgh.pa.us>
	<CAFj8pRD4fCxsRGoV3z73cefPoE4GU-W4ORaVK5VNVTpw3PyjKg@mail.gmail.com>

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





view thread (10+ messages)  latest in thread

Message-ID: <30397.1720116985@sss.pgh.pa.us>
Permalink:  ../30397.1720116985@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/30397.1720116985@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, pavel.stehule@gmail.com, hlinnaka@iki.fi, pgsql-hackers@lists.postgresql.org
  Subject: Re: Improving PL/Tcl's error context reports
  In-Reply-To: <30397.1720116985@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