pgadmin4
pgadmin4 copied to clipboard
Discrepancy in how default values are passed to procedures in the debugger
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:
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':
In which case we get the expected output:
NOTICE: Param's literal value is "'silly'" and string value is "silly"
CALL