Idea-plpgdebugger - A plugin to debug PostgreSQL in Intellij

Overview

Intellij PL/pg SQL debugger

Build Version Downloads

Debug PL/pg SQL in Intellij with Datbase Tool to speed up and improve productivity with PostgreSQL
Allow to debug a query from the console like you run it normally: inspect variables and set breakpoints
The pldbgapi extension must be enabled on the target database.
This plugin is in early stage of development. Submit features => Production ready task list
Report a bug or a problem => Create an issue

Features

  • Direct debug from a console
  • Code inspection
    • Basic variables
    • Arrays(including array of composite)
  • Breakpoints are persisted across sessions

Limitation

The standard pldbgapi does not send back composite variable, but you can put it in arrays to inspect them.
A modified extension is available in this repo, hope this can be integrated in the official extension soon.
At the moment indirect debugging is not supported but will be available soon.

Installation

  • Using IDE built-in plugin system:

    Settings/Preferences > Plugins > Marketplace > Search for "idea-plpgdebugger" > Install Plugin

  • Manually:

    Download the latest release and install it manually using Settings/Preferences > Plugins > ⚙️ > Install plugin from disk...


Plugin based on the IntelliJ Platform Plugin Template.

Comments
  • Run debugging

    Run debugging

    I keep trying to debug the SELECT test_debug('TEST', 1224312); function. Sometimes debugging works on version 1.0.3, and sometimes it doesn't. There is a normal execution of the function with the return of the result and there is no switch to debug mode. I also noticed that after the debugging process, if you simply execute the SELECT test_debug('TEST', 1224312); then its execution time is delayed by tens of seconds.

    Also, after some attempts on the server side, there is a process that can only be killed.

    opened by cvas71 70
  • Provide Docker image with enhanced debugger

    Provide Docker image with enhanced debugger

    The legacy PostgreSQL debugger has some limitations as it only outputs a subset of variable. It only outputs basic variables and arrays. Rows, records and structured type are discarded.

    Compile the modified debugger is not technically difficult but requires a Linux platform as it's too complicated on Windows.

    We can provide a Docker image of the PostgreSQL with the enhanced debugger:

    • Based on legacy image
    • Compile the enhanced debugger against modified sources
    • Install and configure it in shared libraries
    opened by ng-galien 11
  • Cannot debug function from database explorer due to missing extension plpgsql

    Cannot debug function from database explorer due to missing extension plpgsql

    Describe the bug When I try to debug a function by right clicking and selecting "Debug Routine" in the explorer I receive the following error:

    grafik

    To Reproduce Steps to reproduce the behavior:

    1. Create a schema and function to debug:
    create schema if not exists test_schema;
    
    create or replace function test_schema.debug_test() returns text as $$
    begin
      return 'Test';
    end;
    $$ language plpgsql;
    
    1. Richt click 'debug_test' in database explorer
    2. Select 'Debug Routine'

    Expected behavior Function is debugged

    Desktop (please complete the following information):

    • OS: Debian Linux Kernel 5.17.0-1-amd64
    • DataGrip 2022.1.1
    • PostgreSQL Debugger 221.1.2

    Additional context Debugging the following from a console window works as expected:

    select test_schema.debug_test();
    
    bug wait for feedback 
    opened by stevenmccormack 7
  • plugin_debugger and view record type

    plugin_debugger and view record type

    Good afternoon, Sir. I am using your plugin_debugger (https://github.com/ng-galien/pldebugger) library built according to your instructions. I noticed that if in the declared variables there is a variable with the RECORD type, the debugging process ends with an error. [55000] ERROR: record "v_record" is not assigned yet The tuple structure of a not-yet-assigned record is indeterminate. It's easy to check. In your function, which goes for an example, added in the declaration v_record RECORD; and before RETURN pasted the code FOR v_record IN SELECT * FROM public.debug LOOP RAISE NOTICE '%', v_record.id; END LOOP;

    CREATE FUNCTION test_debug(p_text text, p_int integer DEFAULT 0) RETURNS text LANGUAGE plpgsql AS $$ DECLARE v_int_array INT[] = ARRAY [6, 7, 8]; v_custom public.custom_type = (434, 'Custom')::public.custom_type; v_debug_array debug[]; v_debug debug; v_text TEXT = ''; v_int INT = 0; v_date DATE = NULL; v_record RECORD; BEGIN v_text = p_text; v_int_array = ARRAY_APPEND(v_int_array, p_int); SELECT * FROM public.debug LIMIT 1 INTO v_debug; v_int_array = ARRAY_APPEND(v_int_array, 3); SELECT ARRAY_AGG(d) FROM public.debug d INTO v_debug_array; v_int_array = ARRAY_APPEND(v_int_array, 5); v_int_array = ARRAY_APPEND(v_int_array, 7); v_text = 'TEST'; v_int = v_int + 1; v_date = CURRENT_DATE; SELECT ARRAY_AGG(id) FROM public.debug INTO v_int_array; FOR v_record IN SELECT * FROM public.debug LOOP RAISE NOTICE '%', v_record.id; END LOOP;

    RETURN 'DEBUG END';
    

    END $$;

    enhancement 
    opened by cvas71 6
  • Support json format for exploding values and outputs RECORD type in JSON

    Support json format for exploding values and outputs RECORD type in JSON

    JSON and JSONB variables outputs are just inlined and not exploded in the variable view.

    For RECORD type, as it's returned as a ROW without type we can outputs it as JSONB.

    @cvas71 what's your feelings about it?

    enhancement 
    opened by ng-galien 5
  • Debugger only works once

    Debugger only works once

    Started a debugging session from the Database Explorer.

    This worked once. The next time I invoked the same function, it just ran, no debugger.

    M1 Mac, Postgres 14, IntelliJ

    bug wait for feedback 
    opened by gisborne 4
  • Can't debug routines in schema other than `public` (PostgreSQL 14.1)

    Can't debug routines in schema other than `public` (PostgreSQL 14.1)

    Describe the bug I see Routine not found error.

    To Reproduce Steps to reproduce the behavior:

    create schema s_test;
    
    create or replace function s_test.test_debug(p_text text, p_int integer DEFAULT 0) returns text
      language plpgsql
    as
    $$
    BEGIN
      return 'DEBUG END';
    end
    $$;
    
    SELECT s_test.test_debug('TEST', 0);
    

    Try debug last row.

    Expected behavior Should debug routines in schemas

    Screenshots изображение

    opened by ukolovda 4
  • Incorrect position in source method

    Incorrect position in source method

    If in a function, add a comment before DECLARE or, for example, a special command such as #variable_conflict use_variable. When debugging, the cursor is set to a line lower than it should be.

    bug 
    opened by cvas71 3
  • Does not enter to debug (PostgreSQL 14.1, debugger 1.1.0)

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

    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

    bug 
    opened by ukolovda 3
  • Can't debug stored procedures.

    Can't debug stored procedures.

    Describe the bug Can't debug stored procedures.

    To Reproduce Steps to reproduce the behavior:

    create or replace procedure debug_proc_test() as $$
    begin
      null;
    end;
    $$ language plpgsql;
    
    -- Select here and click "Debug" button:
    call debug_proc_test();
    

    Expected behavior Should debug procedures (not functions only),

    Screenshots изображение

    bug 
    opened by ukolovda 3
  • Detection support

    Detection support

    Overview

    Identify the target procedure

    Features

    • [x] Document calling convention
    • [x] Parse the call
    • [x] Handle procedure schema
    • [x] Handle argument schema
    • [x] Test the best candidate
    • [x] Handle quotes
    • [x] Create procedure for detection support
    • [x] Provide two modes for detection, with internal API and Fail back with Queries
    documentation task 
    opened by ng-galien 3
  • Allow to debug anonymous function

    Allow to debug anonymous function

    Debugging an anonymous plpg function can be a great feature.

    • [ ] Detect we are in an anonymous function in the editor
    • [ ] Create a temporary function with the anonymous code in the target
    • [ ] Debug it in direct mode
    • [ ] Delete the temporary function at the end of debugging
    enhancement 
    opened by ng-galien 2
Releases(v222.3.0)
Owner
Alexandre Boyer
Alexandre Boyer
K6-intellij-plugin - IntelliJ-based Plugin to run k6 tests locally or in the k6 Cloud from your IntelliJ IDE

IntelliJ-based Plugin to run k6 tests locally or in the k6 Cloud from your Intel

Mikhail Bolotov 8 Jan 2, 2023
Intellij-platform-plugin-template - IntelliJ Platform Plugin Template

IntelliJ Platform Plugin Template TL;DR: Click the Use this template button and

null 0 Jan 1, 2022
A plugin for Android Studio and Intellij IDEA that speeds up your day to day android development.

ADB Idea A plugin for Android Studio and Intellij IDEA that speeds up your day to day android development. The following commands are provided: Uninst

Philippe Breault 2k Dec 28, 2022
IntelliJ IDEA / PhpStorm InertiaJS Plugin

PhpStorm and IntelliJ IDEA Inertia.js Plugin Provides support in PhpStorm and IntelliJ IDEA Ultimate for Inertia.js. ?? GitHub Issues: feature request

Matthew Hailwood 16 Dec 18, 2022
IntelliJ IDEA plugin for JBang

jbang-intellij-plugin JBang plugin is a plugin for IntelliJ IDEA to integrate JB

jbang - unleash the power of Java 14 Dec 16, 2022
Intellij Idea Plugin that can convert HTML to Compose for Web code.

HtmlToComposeWebConverter Intellij Idea Plugin that can convert HTML to Compose for Web code. Turn this: Into this: Show some ❤️ and star the repo to

Jens Klingenberg 90 Oct 10, 2022
An IntelliJ IDEA plugin is used to inspire you to write code.

InspireWritingPlugin An IntelliJ IDEA plugin is used to inspire you to write code. Whenever you write code that exceeds the specified character, the p

Airsaid 6 Feb 11, 2021
A Mindustry modding Intellij IDEA plugin, named Plumy.

mgppi Template ToDo list Create a new IntelliJ Platform Plugin Template project. Get familiar with the template documentation. Verify the pluginGroup,

Plumy Games 2 Jul 24, 2022
Kirill Rakhman 4 Sep 15, 2022
ADB WIFI Android Studio plugin for debug android app over Wi-Fi.

ADB WIFI ADB WIFI Android Studio plugin for debug android app over Wi-Fi. How to install in Android Studio: go to Preferences

Sutachad Wichai 298 Jan 3, 2023
eventbus-intellij-plugin 3.8 0.0 L1 Java Plugin to navigate between events posted by EventBus.

eventbus-intellij-plugin Plugin to navigate between events posted by EventBus. Post to onEvent and onEvent to Post Install There are two ways. Prefere

Shinnosuke Kugimiya 315 Aug 8, 2022
IDEA plugin.

#Code Review Plugin Download 团队之间Code Review(Diff) 工具 集成 Trello Get Start 配置Task 插件依赖IDEA task 插件的server信息 Perferences -> Tools -> Tasks -> server 添加T

hxc 4 Dec 11, 2021
IDEA plugin demo.

idea-plugin-demo Template ToDo list Create a new IntelliJ Platform Plugin Template project. Get known with the template documentation. Verify the plug

YISEN CAI 0 Nov 3, 2021
🌏 Android/IDEA localization plugin. supports multiple languages and multiple translators.

English | 简体中文 AndroidLocalizePlugin ?? Android/IDEA localization plugin. supports multiple languages and multiple translators. Features Multiple tran

Airsaid 465 Dec 28, 2022
This is an IDEA plugin that allows you to connect Android devices via WiFi for debugging your codes.

AdbWifiUtils Github | Issues | README | 中文文档 ● [Description]: This is an IDEA plugin that allows you to connect Android devices via WiFi for debugging

AWeiLoveAndroid 3 Sep 19, 2022
AsyncAPI - IDEA plugin

AsyncAPI - IDEA plugin ⚠️ This plugin doesn't support AsyncAPI 1.x Idea plugin for the java-asyncapi - Helps to edit and validate AsyncAPI schemas. Fe

AsyncAPI Initiative 5 Dec 27, 2022
IntelliJ Plugin for Android Parcelable boilerplate code generation.

IntelliJ/Android Studio Plugin for Android Parcelable boilerplate code generation This tool generates an Android Parcelable implementation based on fi

Michał Charmas 2.1k Dec 27, 2022
IntelliJ / Android Studio plugin for Android Holo Colors

This project is not maintained anymore. Holo Colors doesn't make sense since the introduction of Material Design and the ability to set the primary co

Jérôme Van Der Linden 644 Nov 10, 2022
Android Studio & IntelliJ Plugin for sort xml by name="xxx".

AndroidXmlSorter Android Studio & IntelliJ Plugin for sort xml by name="xxx". Options Insert space between difference prefix ('Snake Case', 'Camel Cas

Kaoru Tsutsumishita 102 Nov 29, 2022