You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
Right-click on the Person table, and select "View/Edit Data" | "Filtered Rows..."
Type in some text, e.g.,
last_name = 'Doe' and (first_name = 'John' or first_name = 'Jane')
Click OK to run the query
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')
Select and copy the generated SQL
Right-click on the Student table, and select "View/Edit Data" | "Filtered Rows..." (with the intent to use the previous query to select rows)
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'))
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
The text was updated successfully, but these errors were encountered:
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:
last_name = 'Doe' and (first_name = 'John' or first_name = 'Jane')
--> BUG#1: you get a syntax error in the result pane
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):
The text was updated successfully, but these errors were encountered: