This is weird. SQL has ; as a command separator, why treat empty lines specially?
This is weird. SQL has ; as a command separator, why treat empty lines specially?
This is a bizarre client implementation.
I use blank lines to separate sections of long queries all the time for readability and have never had a problem with any tool ever.
You can't safely use semicolons as delimeters unless you parse/tokenize the entire statement (to exclude quoted semicolons). The exact handling of quoted string literals can vary depending on the SQL dialect, or even the configuration, and getting it wrong could cause even more unpredictable behavior.
For instance, on MySQL I don't think it's possible to reliably identify statement boundaries without knowing the server-side value of the NO_BACKSLASH_ESCAPES setting.
There is a setting called 'Blank line is a statement delimiter' which is on by default for some reason
select * from foo
select * from bar
update foo set val=1
will trigger to select statements and do an update.Making newlines significant by default is... well, yeah. OP should beat themselves up a little bit less.
If you wrote `DELIMITER \n` in SQL (if it was allowed) it would be a total shitshow.