-
Notifications
You must be signed in to change notification settings - Fork 239
FeinCMS crash with MySQL 5.5 #445
Description
We had a problem with FeinCMS after moving to MySQL 5.5 (Server version: 5.5.31-0ubuntu0.12.04.2).
MySQL throws following error:
DatabaseError: (1690, "BIGINT UNSIGNED value is out of range in '(projectname.page_page.level - 3)'")
Caused here:
File "feincms/content/application/models.py", line 139, in app_reverse
).order_by('level_diff')[0]
File "django/db/models/query.py", line 207, in getitem
return list(qs)[0]
File "django/db/models/query.py", line 87, in len
self._result_cache.extend(self._iter)
File "django/db/models/query.py", line 291, in iterator
for row in compiler.results_iter():
File "django/db/models/sql/compiler.py", line 763, in results_iter
for rows in self.execute_sql(MULTI):
File "django/db/models/sql/compiler.py", line 818, in execute_sql
cursor.execute(sql, params)
File "django/db/backends/mysql/base.py", line 114, in execute
return self.cursor.execute(query, args)
File "MySQLdb/cursors.py", line 174, in execute
self.errorhandler(self, exc, value)
File "MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
We fixed it by applying this patch:
--- a/feincms/content/application/models.py
+++ b/feincms/content/application/models.py
@@ -135,7 +135,7 @@ def app_reverse(viewname, urlconf, args=None, kwargs=None, prefix=None, *vargs,
) | tree_contents.filter(
parent__lft__lte=proximity_info[2],
parent__lft__gte=proximity_info[1],
-
)).extra({'level_diff':"abs(level-%d)" % proximity_info[3]} -
)).extra({'level_diff':"abs(cast(level as signed)-%d)" % proximity_info[3]} ).order_by('level_diff')[0] except IndexError: content = tree_contents[0]
Can you have a look at this? It reproduces consistently.