PgAdmin 8.4 Query Tool Editor Collapse arrows not collapsing nested statements properly
PGAdmin4 Version 8.4 Application Mode Desktop Current User [email protected] NW.js Version 0.77.0 Browser Chromium 114.0.5735.91 Operating System Windows-10-10.0.22631-SP0
There is no Error Message. The SQL code compiles clean. SQL code included.
Just upgraded from 7.8 to PgAdmin4 Version 8.4
The Query Tool Editors Code Collapse / UnCollapse code is not function properly.
Expected Functionality:
I reinstalled PgAdmin 7.8 to obtain the 7.8 screen shots. PgAdmin 7.8 is functioning properly.
No changes were made to the code.
In PgAdmin 7,8, When collapsing an IF statement, it properly collapses all code, including nested if statements down to the corresponding END IF statement. See Attachment PgAdmin7_8UncollapsedScreenshot.png for the BEFORE Collapse if (....) then .... if(....) then end if; .... end if;
See Attachment PgAdmin7_8CollapsedScreenshot.png for the AFTER Collapse if ... end if;
Also, normally it is the IF statements that have the collapse carot, not other statements.
Unexpected functionality
In PgAdmin8
Looking at the attached PgAdmin8_4UncollapseScreenShot.png file, it can be observed.
- the first nested IF statement does not have a collapse carot but the the line after the first nested IF statement has the carot.
- The second nested IF statement does have the carot but the third nested if statement does not .. etc.
- It seems only every other nested if statement has the collapse carot. It appears the carots are not being properly attached to the IF statements
Looking at the attached PgAdmin8_4CollapseScreenShot.png, it can be observed
- Only the lines of code just after the original IF statement down to the second collapse carot are hidden.
- All other nested lines are still displayed as well as the END IF statement for the top IF statement.
Steps to reproduce the behavior:
-
Install PgAdmin4 7.8 client based not web based
-
Open PgAdmin4 7.8 client
-
Select database instance
-
Select Tools / Query Tool
-
Open the attached SQL Code sample
-
Note all IF statements have a collapse / uncollapse carot before the IF statement
-
Click on any collapse / uncollapse carot and note that all statements between the IF and corresponding END IF statement are hidden / unhidden.
-
Close the PgAdmin client
-
Install PgAdmin 8.4 client based not web based
-
Open PgAdmin4 8.4 client (local client, not web based)
-
Select database instance
-
Select Tools / Query Tool
-
Open the attached SQL Code sample
-
Note not all IF statements have the collapse / uncollapse carots and some non-IF statements do have the carot.
-
Click on any collapse / uncollapse carot and note that not all statements between the IF and corresponding END IF statement are hidden /
I have raised this to the CodeMirror team here - https://discuss.codemirror.net/t/code-folding-for-postgresql-doesnt-work-as-expected/7993
When fixing this, please check - https://www.postgresql.org/message-id/CANQ9y02oCjQSd6SJXTcgi7m0F9jR6MUXQYT-Lu8wEibqp%2B-QWA%40mail.gmail.com