pgadmin4 icon indicating copy to clipboard operation
pgadmin4 copied to clipboard

PgAdmin 8.4 Query Tool Editor Collapse arrows not collapsing nested statements properly

Open adfile opened this issue 1 year ago • 2 comments

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.

  1. the first nested IF statement does not have a collapse carot but the the line after the first nested IF statement has the carot.
  2. The second nested IF statement does have the carot but the third nested if statement does not .. etc.
  3. 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

  1. Only the lines of code just after the original IF statement down to the second collapse carot are hidden.
  2. All other nested lines are still displayed as well as the END IF statement for the top IF statement.

Steps to reproduce the behavior:

  1. Install PgAdmin4 7.8 client based not web based

  2. Open PgAdmin4 7.8 client

  3. Select database instance

  4. Select Tools / Query Tool

  5. Open the attached SQL Code sample

  6. Note all IF statements have a collapse / uncollapse carot before the IF statement

  7. Click on any collapse / uncollapse carot and note that all statements between the IF and corresponding END IF statement are hidden / unhidden.

  8. Close the PgAdmin client

  9. Install PgAdmin 8.4 client based not web based

  10. Open PgAdmin4 8.4 client (local client, not web based)

  11. Select database instance

  12. Select Tools / Query Tool

  13. Open the attached SQL Code sample

  14. Note not all IF statements have the collapse / uncollapse carots and some non-IF statements do have the carot.

  15. Click on any collapse / uncollapse carot and note that not all statements between the IF and corresponding END IF statement are hidden /

SupportingFiles.zip

adfile avatar Mar 13 '24 15:03 adfile

I have raised this to the CodeMirror team here - https://discuss.codemirror.net/t/code-folding-for-postgresql-doesnt-work-as-expected/7993

adityatoshniwal avatar Mar 14 '24 09:03 adityatoshniwal

When fixing this, please check - https://www.postgresql.org/message-id/CANQ9y02oCjQSd6SJXTcgi7m0F9jR6MUXQYT-Lu8wEibqp%2B-QWA%40mail.gmail.com

adityatoshniwal avatar Jun 19 '24 04:06 adityatoshniwal