pgadmin4 icon indicating copy to clipboard operation
pgadmin4 copied to clipboard

Discrepancy in how default values are passed to procedures in the debugger

Open diraneyya opened this issue 5 months ago • 0 comments

Description

Described here https://github.com/EnterpriseDB/pldebugger/issues/33 and copied here as well (for convenience)

Procedure

create or replace procedure issue_pgadmin(
	in param text default 'silly')
language 'plpgsql' as $$
declare
	var text;
begin
	select format('Param''s literal value is "%L" and string value is "%s"', param, param) into var;
	raise notice '%', var;
end $$;

Called from psql

Called, using call issue_pgadmin(); gives the following:

NOTICE:  Param's literal value is "'silly'" and string value is "silly"
CALL

Calling using the debugger

Leave the default value checkbox marked as seen below:

Image

In this case we get this output:

NOTICE:  Param's literal value is "'''silly''::text'" and string value is "'silly'::text"
CALL

Namely, the entire thing 'silly'::text is passed as a string!

This is easily rectified by unchecking the default value checkbox and entering the default string value as just 'silly':

Image

In which case we get the expected output:

NOTICE:  Param's literal value is "'silly'" and string value is "silly"
CALL

diraneyya avatar Aug 10 '25 10:08 diraneyya