pgadmin4
pgadmin4 copied to clipboard
Query Tool: overwrites what I'm typing with unwanted SQL on slow connections
Describe the bug
"Query Tool" has the following misfeature (using default settings): soon after opening, but not immediately after opening, the "Query" edit area is overwritten with the generic SQL for dropping/(re)creating whatever is currently focused in "Object Explorer".
- As a user, I don't care about said generic SQL; if I wanted it (which I don't), I can always right-click on the table and go to
Scripts
>CREATE Script
. If I opened "Query Tool", it is because I want to run my own SQL, not some random unsolicited default, thank you very much! UPDATE: it looks like this behavior might be controlled by the (poorly named?) "Copy SQL from main window to query tool?" option (FWIW, I've never seen a "Main window" with any SQL in it, so I saw no reason to disable the option until I started experimenting some more for this bug report); - To add insult to injury, when the generic SQL is inserted, it is inserted as late as several seconds after the tool actually opens (depending on network latency and server load), overwriting whatever I might have already typed there in the brief interval. #$%&!
To Reproduce
Steps to reproduce the behavior:
- UPDATE: Make sure "Copy SQL from main window to query tool?" is set in the "Query Tool" options (this is the default);
- Select an object (table, schema, ...) in the "Object Explorer" view;
- Click on "Query Tool" button in toolbar;
- Start typing your query right away; N.B. this step is timing-sensitive and may be best reproduced using a non-local (slow-ish) PG connection;
- Observe your query being overwritten with someone's idea of a sensible default that the user never actually asked for.
Expected behavior
If something has already been typed by the time the query that computes the CREATE script comes back, then what has already been typed should be left alone (and the CREATE script thrown away in the trash where it belongs).
(and/or)
Rename "Copy SQL from main window to query tool?" or its uselessly redundant description ("Specifies whether or not to copy SQL to query tool from main window.") to something that corresponds to what's actually going on, so people who want to disable the behavior realize that this is perhaps the option that controls it.
Error message
n/a
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: macOS-12.6.4-x86_64-i386-64bit
- Version: 7.2
- Mode: Desktop
- Browser (if running in server mode): n/a
- Package type: DMG
Additional context
A few years back pgAdmin III used to be a really good and usable tool. Now, some areas (esp. around "Query Tool") are borderline unusable, with useful features that used to be there (such as being able to freely edit the SELECT query generated after picking "View First ZZZ Rows") gone. Sigh.
We should disable the input till the script it loaded.