Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin_debugger not work when has pg_hint_plan on shared_preload_libraries #14

Open
phlaluna opened this issue Jan 12, 2023 · 2 comments

Comments

@phlaluna
Copy link

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;
@phlaluna
Copy link
Author

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.

@jasonchenTJ
Copy link

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants