Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sPR0Y-004aky-O3 for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Jul 2024 18:16:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sPR0W-0020IX-Jd for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Jul 2024 18:16:37 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sPR0W-0020IP-A2 for pgsql-hackers@lists.postgresql.org; Thu, 04 Jul 2024 18:16:37 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sPR0Q-000Qci-Mv for pgsql-hackers@lists.postgresql.org; Thu, 04 Jul 2024 18:16:36 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 464IGPKC030398; Thu, 4 Jul 2024 14:16:25 -0400 From: Tom Lane To: Pavel Stehule cc: Heikki Linnakangas , pgsql-hackers@lists.postgresql.org Subject: Re: Improving PL/Tcl's error context reports In-reply-to: References: <890581.1717609350@sss.pgh.pa.us> <974c2531-536a-4223-a264-166872386459@iki.fi> <26372.1720114586@sss.pgh.pa.us> Comments: In-reply-to Pavel Stehule message dated "Thu, 04 Jul 2024 19:56:13 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <30396.1720116985.1@sss.pgh.pa.us> Date: Thu, 04 Jul 2024 14:16:25 -0400 Message-ID: <30397.1720116985@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Pavel Stehule 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