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

Does not enter to debug (PostgreSQL 14.1, debugger 1.1.0) #31

Closed
ukolovda opened this issue Jan 27, 2022 · 3 comments
Closed

Does not enter to debug (PostgreSQL 14.1, debugger 1.1.0) #31

ukolovda opened this issue Jan 27, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@ukolovda
Copy link

Describe the bug
Debugger execute function without stopping on it.

To Reproduce

create schema if not exists test_schema;

create or replace function test_schema.debug_test() returns text as $$
begin
  return 'A';
end;
$$ language plpgsql;

select test_schema.debug_test(); -- Try debug this

In Debug/Console window it show single line:

[NOTICE] PLDBGBREAK:27

In Service windows it show execution result:
изображение

Expected behavior
Should stop on function body.

Additional context
PostgreSQL 14.1 (Docker-edition)
Plsql Debugger 1.1.0

@ukolovda
Copy link
Author

Full logs:

[DEBUG] Controller: getReady
[CMD] query=GET_EXTENSION, args=[]
[SQL] SELECT * FROM (SELECT 
    t_namespace.nspname,
    t_extension.extname,
    t_extension.extversion
FROM pg_extension t_extension
JOIN pg_namespace t_namespace ON t_extension.extnamespace = t_namespace.oid)q;
[DEBUG] Extension found, version=1.1
[CMD] query=GET_FUNCTION_CALL_ARGS, args=[test_schema, debug_test]
[SQL] SELECT * FROM (SELECT 
       t_proc2.oid,
       t_proc2.pronargs,
       t_proc2.idx,
       t_proc2.proargname,
       concat(t_type_ns.nspname, '.', t_type.typname),
       t_proc2.pronargs > 0 AND idx > (t_proc2.pronargs - t_proc2.pronargdefaults)
FROM (SELECT idx as idx,
             t_proc1.pronargs,
             t_proc1.pronargdefaults,
             t_proc1.oid,
             t_proc1.proargtypes[idx - 1] AS proargtype,
             t_proc1.proargnames[idx]     AS proargname
      FROM (SELECT t_proc.oid,
                   CASE WHEN t_proc.pronargs = 0 THEN '{0}'::oid[] ELSE t_proc.proargtypes::oid[] END AS proargtypes,
                   CASE WHEN t_proc.pronargs = 0 THEN '{""}'::TEXT[] ELSE t_proc.proargnames END      AS proargnames,
                   t_proc.pronargs,
                   t_proc.pronargdefaults,
                   CASE WHEN t_proc.pronargs = 0 THEN 1 ELSE t_proc.pronargs END                      AS serial
            FROM pg_proc t_proc
                     JOIN pg_namespace t_namespace
                          ON t_proc.pronamespace = t_namespace.oid
            WHERE lower(t_namespace.nspname) = lower('test_schema')
              AND lower(t_proc.proname) = lower('debug_test')
            ORDER BY t_proc.oid) t_proc1,
           generate_series(1, t_proc1.serial) idx) t_proc2
         LEFT JOIN pg_type t_type
                   ON t_proc2.proargtype = t_type.oid
         LEFT JOIN pg_namespace t_type_ns ON t_type.typnamespace = t_type_ns.oid)q;
[DEBUG] Controller: initRemote
[CMD] query=DEBUG_OID, args=[1587785]
[SQL] SELECT * FROM plpgsql_oid_debug(1587785);
[INFO] Entering direct debug: entryPoint=1587785"
[DEBUG] Controller: debugBegin
[NOTICE] PLDBGBREAK:27
[CMD] query=ATTACH_TO_PORT, args=[27]
[SQL] SELECT * FROM pldbg_attach_to_port(27);
[INFO] Connected to session =1
[INFO] From auxiliary request: startDebug
[CMD] query=GET_STACK, args=[1]
[INFO] Port reached, discard timeout
[SQL] SELECT * FROM (SELECT 
    frame.level,
    frame.func,
    frame.linenumber,
    md5(pg_catalog.pg_get_functiondef(frame.func))
FROM pldbg_get_stack(1) frame)q;
[DEBUG] Reach frame 1587785, first=true
[CMD] query=GET_FUNCTION_DEF, args=[1587785]
[SQL] SELECT * FROM (SELECT t_proc.oid,
       t_namespace.nspname,
       t_proc.proname,
       pg_catalog.pg_get_functiondef(t_proc.oid),
       md5(pg_catalog.pg_get_functiondef(t_proc.oid))
FROM pg_proc t_proc
         JOIN pg_namespace t_namespace on t_proc.pronamespace = t_namespace.oid
WHERE t_proc.oid = 1587785)q;
[CMD] query=LIST_BREAKPOINT, args=[1]
[SQL] SELECT * FROM (SELECT step.func,
       step.linenumber,
       ''
FROM pldbg_get_breakpoints(1) step)q;
[DEBUG] Got to next
[CMD] query=STEP_CONTINUE, args=[1]
[INFO] Terminated without exception
[SQL] SELECT * FROM (SELECT step.func,
       step.linenumber,
       md5(pg_catalog.pg_get_functiondef(step.func))
FROM pldbg_continue(1) step)q;
[CMD] query=GET_STACK, args=[1]
[SQL] SELECT * FROM (SELECT 
    frame.level,
    frame.func,
    frame.linenumber,
    md5(pg_catalog.pg_get_functiondef(frame.func))
FROM pldbg_get_stack(1) frame)q;
[DEBUG] Reach frame null, first=true
[INFO] User request: stop
[INFO] Terminated without exception

@ng-galien
Copy link
Owner

ng-galien commented Jan 27, 2022

Please upgrade to 1.1.1, it solves the problem

[DEBUG] Got to next
[CMD] query=STEP_CONTINUE, args=[1]

https://github.com/ng-galien/idea-plpgdebugger/blob/main/src/main/kotlin/net/plpgsql/ideadebugger/PlProcess.kt#L135

@ng-galien ng-galien added the bug Something isn't working label Jan 27, 2022
@ng-galien ng-galien self-assigned this Jan 27, 2022
@ukolovda
Copy link
Author

Thank you!
1.1.1 works fine!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants