From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | phb(dot)emaj(at)free(dot)fr, pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: BUG #18767: Inconsistency in result of a Plpgsql GET DIAGNOSTICS PG_CONTEXT instruction. |
Date: | 2025-01-06 16:24:06 |
Message-ID: | CAFj8pRDHHcLFhaw+3-sdpg5g4tAe1726ghVV6Vfm+RkNm6=+LA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Hi
It is not a bug. GET DIAGNOSTICS PG_CONTEXT returns error context
Error context is generated by the function plpgsql_exec_error_callback.
This function uses estate->func->fn_signature string
and this string is generated by function format_procedure. This function
hides schema when function is visible from current search_path
(2025-01-06 17:01:05) postgres=# create schema test;
CREATE SCHEMA
(2025-01-06 17:01:26) postgres=# create function public.fx(a int) returns
void as $$ begin end $$ language plpgsql;
CREATE FUNCTION
(2025-01-06 17:01:47) postgres=# create function test.fx(a int) returns
void as $$ begin end $$ language plpgsql;
CREATE FUNCTION
(2025-01-06 17:02:16) postgres=# select 'test.fx'::regproc;
┌─────────┐
│ regproc │
╞═════════╡
│ test.fx │
└─────────┘
(1 row)
(2025-01-06 17:02:22) postgres=# select 'test.fx'::regproc::regprocedure;
┌──────────────────┐
│ regprocedure │
╞══════════════════╡
│ test.fx(integer) │
└──────────────────┘
(1 row)
(2025-01-06 17:02:27) postgres=# select 'public.fx'::regproc::regprocedure;
┌──────────────┐
│ regprocedure │
╞══════════════╡
│ fx(integer) │
└──────────────┘
(1 row)
This is mostly used for displaying functions in error messages.
Unfortunately it is not possible to change it without a compatibility
break. This was designed more than 20 years ago.
If you want to track function calls exactly you need own extension based on
pl debug api like https://github.com/EnterpriseDB/pldebugger
Regards
Pavel
From | Date | Subject | |
---|---|---|---|
Next Message | Anmol Mohanty | 2025-01-06 19:07:29 | Re: BUG #18765: Inconsistent behaviour and errors with LIKE |
Previous Message | Richard Guo | 2025-01-06 13:14:10 | Re: BUG #18764: server closed the connection unexpectedly |