psql multi-line on Sublime breaks
Hi,
Thanks for making this awesome plugin. While it works very well when I inline my entire psql query, I do get an error if I split even the simplest query such as the one down below into multiple lines
select count(*)
from mytable
ERROR: syntax error at or near "from"
LINE 1: from mytable
-- This will work though
select count(*) from mytable
This naturally limits the ability to perform complex queries. Let me know if you are aware of this issue and if I can help fix it. Thanks
Quick update - this does work if I select the entire query contents. Otherwise it only executes the query on the line the cursor is on. So feel free to close the issue if you think that is sufficient. But it seems like upon SQL execute, we should select all the contents of the file and not just the line the cursor is on. Thanks
I just ran into this issue, thanks for updating the ticket @njj023 I was about to give up and move on. Selecting the file or even better selecting the statement that the cursor is placed within would be ideal.
Hi, you're right, today the execute command executes only the current line, maybe we should add another command running all file, or searching for an ";" to execute the current query. I'm thinking about it
+1 for the searching for an ";" solution!
Same problem with MySql:
select * from customer where id = 592; -- Works!
select * from customer
where id = 592; -- Only works if you select the two lines!
To execute the statement before the ";" is a very common work practice in MySQL Workbench, so I think this would be an appreciated feature for people use to that :)
Suggest to execute entire file and let db output results. For example if there 2 queries in file separated with ; it will print 2 tables in result's window.
I don't agree with @xolvo 's idea.. For me it would be nicer if it worked like MySQL Workbench where it only executes one statement. Often my (and my colleges) files contains 8 statements (or more) separated by ;, if all were executed there would be too many tables in the result's window.
Personally I would really appreciate the option to select and execute the whole file. I recognize @Cottin has a point that sometimes a user doesn't want to run the whole file. In my case, sometimes I want to run files that have variables set at the start and cleared later. to do that you really do want the whole file to be executed to ensure things work right.
So maybe two executes, execute all and execute current statement.