EnterpriseDB/pldebugger

Plugin_debugger not work when has pg_hint_plan on shared_preload_libraries

phlaluna opened this issue · 2 comments

Hi,

I did several tests and the Debbuger Plugin does not work when the shared_preload_libraries has "plugin_debugger,pg_hint_plan".
When shared_preload_libraries has only "plugin_debugger" or with other libraries like "auto_explain,plugin_debugger,pg_stat_statements,pg_repack", it's work.

I can create function and create extension without any error. But when I use Debug from PGAdmin or Dbeaver it doesn't return the debug result.

Works:
shared_preload_libraries="auto_explain,plugin_debugger,pg_stat_statements,pg_repack"
return-debug-without-pg-hint

Problem:
shared_preload_libraries="plugin_debugger,pg_hint_plan"
pgadmin-with-pg-hint-no-parameters
pgadmin-with-pg-hint-no-result
pgadmin-with-pg-hint-no-stack

Script to create test function:

CREATE SCHEMA test;
DROP function if exists test.somefunc(var integer);
CREATE FUNCTION test.somefunc(var integer) RETURNS integer AS $$
DECLARE
   quantity integer := 30+var;
BEGIN
   RAISE NOTICE 'Quantity here is %', quantity;      --30
   quantity := 50;
   --
   --
   DECLARE
      quantity integer := 80;
   BEGIN
      RAISE NOTICE 'Quantity here is %', quantity;   --80
   END;
   RAISE NOTICE 'Quantity here is %', quantity;      --50
   RETURN quantity;
END;
$$ LANGUAGE plpgsql;
CREATE EXTENSION pldbgapi;

I opened an issue on postgresql and they replied the following:

The plugin debugger uses dbg API, pg_hint_plan uses dbg API too. Unfortunately this API is not designed to be used by two active extensions in one time.

I found a workaround in plpgsql_check, but it requires modification in extensions. You should report this issue to their authors.

https://github.com/ossc-db/pg_hint_plan/issues
https://github.com/EnterpriseDB/pldebugger/issues

The fix is not on the PostgreSQL side.

@phlaluna
Hi Bro, I met the same issue.
My PG version is 16.1.
The conflict plugins are auto_explain and plugin_debugger.

The problem probably due to internal hook programming.

Thanks
Jason