Re: BUG #18767: Inconsistency in result of a Plpgsql GET DIAGNOSTICS PG_CONTEXT instruction.
От | Pavel Stehule |
---|---|
Тема | Re: BUG #18767: Inconsistency in result of a Plpgsql GET DIAGNOSTICS PG_CONTEXT instruction. |
Дата | |
Msg-id | CAFj8pRDHHcLFhaw+3-sdpg5g4tAe1726ghVV6Vfm+RkNm6=+LA@mail.gmail.com обсуждение исходный текст |
Ответ на | BUG #18767: Inconsistency in result of a Plpgsql GET DIAGNOSTICS PG_CONTEXT instruction. (PG Bug reporting form <noreply@postgresql.org>) |
Ответы |
Re: BUG #18767: Inconsistency in result of a Plpgsql GET DIAGNOSTICS PG_CONTEXT instruction.
|
Список | 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)
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
В списке pgsql-bugs по дате отправления: