From 9bf971103099e9734de48275734e6afbcd3bff46 Mon Sep 17 00:00:00 2001 From: Anil Sahoo Date: Tue, 25 Nov 2025 17:38:02 +0530 Subject: [PATCH] Fix an issue on type casting of default string function/procedure arguments in debugger tool. #9036 --- .../debugger/sql/get_function_debug_info.sql | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/web/pgadmin/tools/debugger/templates/debugger/sql/get_function_debug_info.sql b/web/pgadmin/tools/debugger/templates/debugger/sql/get_function_debug_info.sql index f04e59dc435..1c09fe34a2c 100644 --- a/web/pgadmin/tools/debugger/templates/debugger/sql/get_function_debug_info.sql +++ b/web/pgadmin/tools/debugger/templates/debugger/sql/get_function_debug_info.sql @@ -49,7 +49,24 @@ SELECT pg_catalog.pg_get_function_identity_arguments(p.oid) AS signature, {% if hasFeatureFunctionDefaults %} - pg_catalog.pg_get_expr(p.proargdefaults, 'pg_catalog.pg_class'::regclass, false) AS proargdefaults, + pg_catalog.array_to_string( + ARRAY( + SELECT + -- Removing type cast, then removing surrounding single quotes if present + CASE + WHEN regexp_replace(val, E'::[a-zA-Z_]+$', '') ~ E'^''.*''$' + THEN substring(regexp_replace(val, E'::[a-zA-Z_]+$', '') FROM E'^''(.*)''$') + ELSE regexp_replace(val, E'::[a-zA-Z_]+$', '') + END + FROM unnest( + regexp_split_to_array( + pg_catalog.pg_get_expr(p.proargdefaults, 'pg_catalog.pg_class'::regclass, false), + ',\s*' + ) + ) AS val + ), + ',' + ) AS proargdefaults, p.pronargdefaults {%else%} '' AS proargdefaults, 0 AS pronargdefaults