pldebugger icon indicating copy to clipboard operation
pldebugger copied to clipboard

Discrepancy in passing default values to procedures in the debugger

Open diraneyya opened this issue 5 months ago • 0 comments

Hello.

This could be a bug in pgAdmin or a bug in a pldebugger. I am not entirely sure.

In either case I am posting it on both projects' issues pages.

Procedure

create or replace procedure issue_pldebugger(
	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_pldebugger(); 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