-
-
Notifications
You must be signed in to change notification settings - Fork 3k
-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
db manager's SQL window freezes with long query (due to syntax coloring?) #16099
Comments
Author Name: Mathieu Pellerin - nIRV (Mathieu Pellerin - nIRV)
|
Author Name: Mathieu Pellerin - nIRV (Mathieu Pellerin - nIRV) oups, seems the SQL query was cut-off. I've attached the query as a text file.
|
Author Name: Mathieu Pellerin - nIRV (Mathieu Pellerin - nIRV) To avoid confusion: this is about interface freezing when editing a query (i.e. not a freeze while the query is being executed). Thinking out-loud: maybe the checkbox is overkill and confusing. The syntax coloring code could look at the length of the query, and above a number of characters would skip coloring. A simple
|
Author Name: Giovanni Manghi (@gioman)
|
Author Name: Giuseppe Sucameli (@brushtyler) Pasting or editing such a query makes highlighting process slow here, but it doesn't freeze (it could depend on resources available on my notebook).
|
Author Name: Giovanni Manghi (@gioman)
|
Author Name: Martin Dobias (@wonder-sk) The SQL syntax highlighting is highly inefficient, involving more than a thousand of regular expressions being matched to the text many many times. I haven't found an easy way how to fix that in reasonable amount of time - I think we need to rework the tokenizer and that is beyond a simple bug fix. For the mean time, I suggest disabling the highlighting to overcome the problem. Any objections? |
Author Name: Paolo Cavallini (@pcav) -1: even on an Atom machine, the slowdown is acceptable, and the syntax colouring is a big plus. |
Author Name: Alexander Bruy (@alexbruy) Maybe we should drop current implementation and use something another instead? For example QScintilla. I talked with Giuseppe about this recently and he has no objections. Here is a pull-request #1162. Maybe it needs some more work, but most functionality already here. |
Author Name: Mathieu Pellerin - nIRV (Mathieu Pellerin - nIRV) Paolo, the "slowdown" is a freeze of the application that leaves the user with the only option to kill QGIS (see the initial description) when using absurdly long SQL strings (which can happen if you input a geometry, as with the above-mentioned example). Paolo, Martin, Alex, I think the easiest temporary fix that might be worth doing for 2.2 is simply to disable the current inefficient highlighting when the number of characters in the SQL string is greater than a tolerable number. |
Author Name: Paolo Cavallini (@pcav) +1 for this. thanks. |
Author Name: Martin Dobias (@wonder-sk) I will have a look at Alex's patch... |
Author Name: Martin Dobias (@wonder-sk) Fixed in changeset "61ff7432107da0a7ce991f68094b9f42dd1027a5".
|
Author Name: Mathieu Pellerin - nIRV (Mathieu Pellerin - nIRV)
Original Redmine Issue: 6995
Affected QGIS version: master
Redmine category:db_manager
Discovered this while trying to update a field from a spatialite point dataset. The db manager's SQL window will freeze when modifying long query, most probably due to syntax coloring.
It might be good to have a check box within the SQL window to disable syntax coloring in such cases, if things can't be improved.
Steps to reproduce:
1/ open db manager's SQL window (connected to a spatialite or postgis database, it doesn't matter)
2/ paste the query below into the query text box (notice the short freeze, which doesn't crash QGIS yet)
3/ try to modify the query by typing a few characters into the query text box
At that stage, QGIS should freeze, and remain frozen until the user kills it.
SQL query (the WKT is a simplified polygon representing Cambodia's territory) :
The text was updated successfully, but these errors were encountered: