pyrrha icon indicating copy to clipboard operation
pyrrha copied to clipboard

SQL bug while fetching morph

Open MrGecko opened this issue 5 years ago • 1 comments

Current Behaviour

Don't know much about how it happened since I just caught it in a log (from today) :

Traceback (most recent call last):
 File "pyrrha/venv/lib/python3.5/site-packages/sqlalchemy/engine/default.py", line 552, in do_execute
    cursor.execute(statement, parameters)
sqlite3.OperationalError: near ")": syntax error
...
  File " pyrrha/app/control_lists/views.py", line 211, in search_api
    ).limit(AUTOCOMPLETE_LIMIT)
...
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) near ")": syntax error
[SQL: SELECT allowed_morph.label AS allowed_morph_label, allowed_morph.readable AS allowed_morph_readable 
FROM allowed_morph 
WHERE allowed_morph.control_list = ? AND () GROUP BY allowed_morph.label
 LIMIT ? OFFSET ?]
[parameters: (3, 20, 0)]

It may be about the empty AND () in the query

Correct Behaviour

  1. No bugs.
  2. The issue relates potentially from an empty query parameters.
  3. No search should be perform if the value is empty.

MrGecko avatar Oct 31 '19 09:10 MrGecko