Open snuyanzin opened 5 years ago
Thanks for the report @snuyanzin.
The example is a bit tricky, since I don't think C-style comments can be nested, so the query actually does contain an unmatched '
as the first one is commented out. As I understand it:
select
1
/*'/* */ <- comment ends after first */
'*/ <- this ' is unmatched
;
Do you have another example without nested multi-line comment delimiters that exhibits the problem?
Without looking into it, I wonder if it's possible to indicate after pressing Enter that the query wasn't executed due to an unmatched quote, which might help identify issues like this a bit more clearly, rather than Enter seemingly not working
I don't think C-style comments can be nested
according postgresql documentation it could be https://www.postgresql.org/docs/8.0/sql-syntax.html#SQL-SYNTAX-COMMENTS
there are a number of other more complicated examples with such comments. Here I just posted the simplest one. If it helps I could provide others
Thanks for the link @snuyanzin - I didn't know about this feature of C-style comments in SQL!
Having looked into it a bit more, the cause of this issue is a bug in the sqlparse
library that we use - I've commented with some background on the open issue regarding nested comments https://github.com/andialbrecht/sqlparse/issues/410#issuecomment-547688075 and I had a quick look at the sqlparse
code, but it wasn't going to be a quick fix for me to make.
Description
Sometimes while multiline mode it is impossible to submit a query with single quotes inside multiline comments. After playing with that I was able to find a simple query to reproduce
Moreover it is impossible to finish editing this query (the only option I found is CTRL+C)
At the same time in case one-line mode the same query is submitted successfully
Your environment
pip freeze
command.