Borvik / vscode-postgres

PostgreSQL extension for vscode providing explorer, highlighting, diagnostics, and intellisense
MIT License
228 stars 49 forks source link

Add default limit command to commands on first fetch #225

Closed rlh1994 closed 1 year ago

rlh1994 commented 1 year ago

When querying large tables I often forget to add a limit clause to by default, which causes the query to hang or the output not to load. It would be nice to have a setting that adds a default limit clause to queries until I scroll further/try and return/save all results if possible?

Borvik commented 1 year ago

I understand the idea behind this, however there are complications that prevent this solution.

First, since this extension allows you to run more than just SELECT statements, this absolutely would require a robust query parser to determine if a limit clause even could be added to a query - which it doesn't.

Second, it goes a bit against the design I had of "do not alter queries". Basically I want consistency in the queries... what you see is what you run - no hidden gimmicks or gotchas.

Perhaps an alternative though would be that there be the ability to cancel long-running queries like #62

rlh1994 commented 1 year ago

That's entirely fair and makes perfect sense. How about an additional command that is something like Run Query (limit 100) or would that not be suitable for the same reasons?