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 1sPONG-004NdW-8R for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Jul 2024 15:27:54 +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 1sPONE-000jfg-9x for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Jul 2024 15:27:53 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sPOND-000jfO-Rn for pgsql-hackers@lists.postgresql.org; Thu, 04 Jul 2024 15:27:52 +0000 Received: from lahtoruutu.iki.fi ([185.185.170.37]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sPONB-000OBY-8w for pgsql-hackers@lists.postgresql.org; Thu, 04 Jul 2024 15:27:51 +0000 Received: from [192.168.1.112] (dsl-hkibng22-54f8db-125.dhcp.inet.fi [84.248.219.125]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hlinnaka) by lahtoruutu.iki.fi (Postfix) with ESMTPSA id 4WFLB80fNlz49Q3r; Thu, 4 Jul 2024 18:27:43 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1720106865; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=g2B44OncVBCCXzKBbLfemnELiY4KKB6If+NkBWW+10Q=; b=nIaODSLQC8GVFaDIwKfbCYmk+b+dfIMv/HWZpQflJ7XiW/oqZhOKjABXtuoB86o6nwrs2i HJHll8sp8O2DeTLMxhpqOSfK+UHamsSGNfi0KKmu8opImI6nc5bLUba5SXDP+tGFaNdRNY KhfOHN8VzNZA7e9FmPwng7bpruUh8wm3CXjD/wkmPC0+i5kvB0ggipKbZdcKExAXxZcSVH TdVQI71mTSJbCLh5XyuJl8RNewbSQurF2eiaxr+GVwBeZtPSQvx7XhFLGgNoMnUqbrku55 ZFiAKXIvHCPfv4jUfwWIfr4XRfLRPwo0Iob2plomQCo9KaQvwhtAT3ALv4vuUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1720106865; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=g2B44OncVBCCXzKBbLfemnELiY4KKB6If+NkBWW+10Q=; b=b064JoMG+R51ihjKvDFwqkUcw00jaR+uBp8J4Xb4RMxdOXQ0aaJPsOLHrIBRUg821Ey1V2 fUKUKQxG8NaGVx6/d60KYnjWDqwEY/cvvmpjkp+FDtpIE6eMv3ljBqEtoHJ8vzIyXZDh2o T1ffd4inHRsmNO6YHCkXDZNSpcEDuDDg1Ge+RjD1cmbv7dOv64AnFG7lAp/GQsW+U/6Csx +WFmf1oafEKzaC04pMpn2NH+1IxZdKTt1B6qpLFeR/QKZDWCkj8K4Q4iqjHRCEjnh4kbsP eloUV18JgEhDB27tW/2e4WJO4NKdBBvYN+2pPrcyCDU8q4U9eyoRsesCEyjCqA== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=hlinnaka smtp.mailfrom=hlinnaka@iki.fi ARC-Seal: i=1; s=lahtoruutu; d=iki.fi; t=1720106865; a=rsa-sha256; cv=none; b=oMRcB/IOKFFXsYjLN5bje2KHK33wDphC5XWcPWwB2/XCqIdGjk2dPvEuqY8HbTSF2RUIE0 uIW/ZqAH4Qzwflcu5QYnKqrZlL6k9GoCN6lW1J9smcSsJZGWv5Now6+RQpYN+ucUa2qR1Y ZO+aE6lbVltlVuSqfoitbyotpls1R8AM0e+6lhkmDkjuern24+qFn3u+sZdy9EnTYRU9sY sVJorZIXarMMaEvUU47iuwg0eCEKoT/GjNdyygqT6KXQZ9stkLPArt5DW9wRHblTyg8Gc8 IcmZxzi6TCRkwgEavml3rY7199zWPkeo3upEtc1hwtt5LOiDK7gMXL0P9yHZIg== Message-ID: <974c2531-536a-4223-a264-166872386459@iki.fi> Date: Thu, 4 Jul 2024 18:27:43 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Improving PL/Tcl's error context reports To: Tom Lane , pgsql-hackers@lists.postgresql.org References: <890581.1717609350@sss.pgh.pa.us> Content-Language: en-US From: Heikki Linnakangas In-Reply-To: <890581.1717609350@sss.pgh.pa.us> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 05/06/2024 20:42, Tom Lane wrote: > While working on commit b631d0149, I got a bee in my bonnet about > how unfriendly PL/Tcl's error CONTEXT reports are: > > * The context reports expose PL/Tcl's internal names for the Tcl > procedures it creates, which'd be fine if those names were readable. > But actually they're something like "__PLTcl_proc_NNNN", where NNNN > is the function OID. Not only is that unintelligible, but because > the OIDs aren't stable this forces us to disable display of the > CONTEXT lines in all of PL/Tcl's regression tests. > > * The first line of the context report (almost?) always duplicates > the primary error message, which is redundant and not per our > normal reporting style. > > So attached is a patch that attempts to improve this situation. > > The key question is how to avoid including function OIDs in the > strings that will appear in the regression test outputs. The > answer I propose is to start with an internal name like > "__PLTcl_proc_NAME", where NAME is the function's normal SQL name, > and then append the OID only if that function name is not unique. > As long as we don't create test cases that involve throwing > errors from duplicatively-named functions, we can show the context > reports and still have stable regression outputs. I think this will > improve the user experience for regular users too. Yes, that sounds a lot nicer. What happens if you rename a function? I guess the error context will still print the old name, but that's pretty harmless. Hmm, could we do something with tcl namespaces to allow having two procedures with the same name? E.g. create a separate namespace, based on the OID, for each procedure. I wonder how the stack trace would look like then. -- Heikki Linnakangas Neon (https://neon.tech)