Edgewall Software

Opened 5 years ago

Last modified 5 years ago

#13128 closed defect

Timeline broken with a MySQL 8.0 backend — at Version 4

Reported by: anonymous Owned by: Jun Omae
Priority: normal Milestone: 1.0.18
Component: database backend Version: 1.2.2
Severity: major Keywords: mysql
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Ryan J Ollos)

After upgrading from MySQL 5.7 to MySQL 8.0, I'm getting the following error message when accessing the "Timeline" in my Trac instance:

Trac detected an internal error:

ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'system WHERE name='initial_database_version'' at line 1")


Python Traceback
Most recent call last:

File "C:/server/trac/.egg-cache/trac-1.2.2-py2.7-win32.egg-tmp/trac/timeline/templates/timeline.html", line 63, in <Expression u"event.render('description', context)">
  ${event.render('description', context)}
File "c:/users/trac/appdata/local/temp/easy_install-ni58x7/Trac-1.2.2-py2.7-win32.egg.tmp/trac/timeline/web_ui.py", line 374, in <lambda>
  provider.render_timeline_event(context, field, event)
File "c:/users/trac/appdata/local/temp/easy_install-ni58x7/Trac-1.2.2-py2.7-win32.egg.tmp/trac/ticket/web_ui.py", line 411, in render_timeline_event
  t_context.set_hints(preserve_newlines=self.must_preserve_newlines)
File "c:/users/trac/appdata/local/temp/easy_install-ni58x7/Trac-1.2.2-py2.7-win32.egg.tmp/trac/util/__init__.py", line 1202, in __get__
  result = self.fn(instance)
File "c:/users/trac/appdata/local/temp/easy_install-ni58x7/Trac-1.2.2-py2.7-win32.egg.tmp/trac/ticket/web_ui.py", line 125, in must_preserve_newlines
  preserve_newlines = self.env.database_initial_version >= 21 # 0.11
File "c:/users/trac/appdata/local/temp/easy_install-ni58x7/Trac-1.2.2-py2.7-win32.egg.tmp/trac/util/__init__.py", line 1202, in __get__
  result = self.fn(instance)
File "c:/users/trac/appdata/local/temp/easy_install-ni58x7/Trac-1.2.2-py2.7-win32.egg.tmp/trac/env.py", line 613, in database_initial_version
  .get_database_version('initial_database_version')
File "c:/users/trac/appdata/local/temp/easy_install-ni58x7/Trac-1.2.2-py2.7-win32.egg.tmp/trac/db/api.py", line 480, in get_database_version
  """, (name,))
File "c:/users/trac/appdata/local/temp/easy_install-ni58x7/Trac-1.2.2-py2.7-win32.egg.tmp/trac/db/api.py", line 122, in execute
  return db.execute(query, params)
File "c:/users/trac/appdata/local/temp/easy_install-ni58x7/Trac-1.2.2-py2.7-win32.egg.tmp/trac/db/util.py", line 128, in execute
  cursor.execute(query, params if params is not None else [])
File "c:/users/trac/appdata/local/temp/easy_install-ni58x7/Trac-1.2.2-py2.7-win32.egg.tmp/trac/db/util.py", line 72, in execute
  return self.cursor.execute(sql_escape_percent(sql), args)
File "C:/server/Python27/lib/site-packages/MySQLdb/cursors.py", line 205, in execute
  self.errorhandler(self, exc, value)
File "C:/server/Python27/lib/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
  raise errorclass, errorvalue

Reason: system has become a reserved keyword in MySQL 8.0.

Location: tags/trac-1.2.3/trac/db/api.py#L479

Change History (6)

by anonymous, 5 years ago

ou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'system WHERE name='initial_database_version at line 1

by anonymous, 5 years ago

Attachment: mysql-8-system.diff added

Patch

comment:1 by anonymous, 5 years ago

I have added a patch that fixed the problem for me (I checked out the 1.2-branch, applied the changes and python ./setup.py installed it).

comment:2 by Jun Omae, 5 years ago

Keywords: mysql added
Milestone: 1.2.41.0.18
Owner: set to Jun Omae
Status: newassigned
Version: 1.2.3

Thanks for the reporting and patch, however your patch doesn't work with PostgreSQL.

I'll fix it based the patch.

comment:3 by Jun Omae, 5 years ago

Version: 1.2.31.2.2

comment:4 by Ryan J Ollos, 5 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.