GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Multi-line SQL generated by pgAdmin that is pasted into "Filter Rows..." results in a syntax error · Issue #8254 · pgadmin-org/pgadmin4

Multi-line SQL generated by pgAdmin that is pasted into "Filter Rows..." results in a syntax error #8254

New issue
Copy link
New issue
Copy link
Closed
Closed
Multi-line SQL generated by pgAdmin that is pasted into "Filter Rows..." results in a syntax error#8254
Copy link
Assignees
yogeshmahajan-1903
Labels
Bug
Milestone
9.0

Description

@usernamesareaholdoverfromthe90s
usernamesareaholdoverfromthe90s
opened on Dec 11, 2024
Issue body actions

Describe the bug

Generated SQL copied from one pgAdmin window into a "Filter Rows..." window of another results in broken SQL because the CR/LF is not interpreted as white space

To Reproduce

Assume you have a table called Person, with PK "person_id_pk", and a table called Student with FK "person_id_fk".

Steps to reproduce the behavior:

  1. Right-click on the Person table, and select "View/Edit Data" | "Filtered Rows..."
  2. Type in some text, e.g.,

last_name = 'Doe' and (first_name = 'John' or first_name = 'Jane')

  1. Click OK to run the query
  2. Note that the SQL listed in the result looks like
SELECT * FROM public.person
WHERE last_name = 'Doe' and (first_name = 'John' or first_name = 'Jane')
  1. Select and copy the generated SQL
  2. Right-click on the Student table, and select "View/Edit Data" | "Filtered Rows..." (with the intent to use the previous query to select rows)
  3. Type in "person id in ()", and then paste in the copied SQL within the parentheses, and change the "*" to be "person_id_pk", so that you end up with
person_id_fk in (SELECT person_id_pk FROM public.person
WHERE last_name = 'Doe' and (first_name = 'John' or first_name = 'Jane'))
  1. Click OK to run the query
    --> BUG#1: you get a syntax error in the result pane
ERROR:  syntax error at or near "="
LINE 2: ...ELECT person_id_pk FROM public.personWHERE last_name = 'Doe' and...
                                                             ^ 

SQL state: 42601
Character: 100

I.e, the CR/LF at the end of line 1 of the generated/copied/pasted SQL is being stripped out, but not replaced with a space, so the two joined lines are resulting in illegal syntax.

--> BUG#2: you can't edit the query to correct the mistake. I.e., clicking on the "Sort/Filter" icon doesn't do anything (and, hovering over it shows the default (arrow) cursor without tooltip, rather than the pointer (finger) cursor saying "Sort/Filter". So all you can do is go back to step 6, and start again.

Note, the work around in step 7 is to put the cursor at the end of line 1 and manually add a space character after "public.person"

Expected behavior

I expect that when someone pastes in multi-line SQL, and if those lines really do need to be joined, then you'd ensure that that a space character is used (e.g., use .join( " " ), rather than .join( "" )... depending on the language you're using) so that it doesn't result in a syntax error. Or perhaps the CR/LF shouldn't be stripped out at all?

And, I would expect that if the "View/Edit Data" | "Filtered Rows..." contains a syntax error, I should be able to click on the "Sort/Filter" icon to correct my mistake.

Error message

See step 8, above

Screenshots

If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Windows 10
  • Version: 8.13

Activity

  1. usernamesareaholdoverfromthe90s
    added
    Bug
    on Dec 11, 2024
  2. akshay-joshi
    added this to Not Refinedon Dec 12, 2024
  3. akshay-joshi
    added
    EDB Sprint 182
    on Dec 16, 2024
  4. akshay-joshi
    added this to Current Sprint (213) and removed this from Not Refinedon Dec 16, 2024
  5. akshay-joshi
    moved this to 🆕 New in Current Sprint (213)on Dec 16, 2024
  6. akshay-joshi
    added
    EDB Sprint 183
    and removed
    EDB Sprint 182
    on Dec 18, 2024
  7. RohitBhati8269
    self-assigned this
    on Dec 23, 2024
  8. RohitBhati8269
    moved this from 🆕 New to 🏗 In Progress in Current Sprint (213)on Dec 24, 2024
  9. RohitBhati8269
    added 2 commits that reference this issue on Dec 24, 2024

    1. Fix SQL formatting issue where line breaks are not treated as whit…

    6ce2843

    Fix SQL formatting issue where line breaks are not treated as whitesp…

    e9acb81
  10. RohitBhati8269
    moved this from 🏗 In Progress to In Review in Current Sprint (213)on Dec 25, 2024
  11. adityatoshniwal
    added a commit that references this issue on Dec 30, 2024

    Fix a formatting issue in View/Edit tool generated SQL where some fil…

    bcd6f3f
  12. adityatoshniwal
    moved this from In Review to In Testing in Current Sprint (213)on Jan 1, 2025
  13. adityatoshniwal
    added this to the 9.0 milestone on Jan 1, 2025
  14. adityatoshniwal
    unassigned
    RohitBhati8269
    on Jan 1, 2025
  15. akshay-joshi
    added
    EDB Sprint 184
    and removed
    EDB Sprint 183
    on Jan 2, 2025
  16. yogeshmahajan-1903
    self-assigned this
    on Jan 3, 2025
  17. yogeshmahajan-1903 commented on Jan 3, 2025

    @yogeshmahajan-1903
    yogeshmahajan-1903
    on Jan 3, 2025
    Contributor
    More actions

    This is working fine.

  18. yogeshmahajan-1903
    closed this as completedon Jan 3, 2025
  19. yogeshmahajan-1903
    moved this from In Testing to ✅ Done in Current Sprint (213)on Jan 3, 2025
  20. akshay-joshi
    removed this from Current Sprint (213)on Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @yogeshmahajan-1903
    yogeshmahajan-1903

Labels

Bug

Type

No type

Projects

No projects

    Milestone

    • 9.0

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.