=== modified file 'trac/db_default.py'
--- trac/db_default.py	
+++ trac/db_default.py	
@@ -148,7 +148,7 @@
         Column('id', auto_increment=True),
         Column('author'),
         Column('title'),
-        Column('sql'),
+        Column('query'),
         Column('description')],
 ]
 
@@ -379,7 +379,7 @@
              ('name', 'value'),
                (('database_version', str(db_version)),)),
            ('report',
-             ('author', 'title', 'sql', 'description'),
+             ('author', 'title', 'query', 'description'),
                __mkreports(reports)))
 
 default_config = \

=== modified file 'trac/ticket/report.py'
--- trac/ticket/report.py	
+++ trac/ticket/report.py	
@@ -148,11 +148,11 @@
             req.redirect(self.env.href.report())
 
         title = req.args.get('title', '')
-        sql = req.args.get('sql', '')
+        query = req.args.get('query', '')
         description = req.args.get('description', '')
         cursor = db.cursor()
-        cursor.execute("INSERT INTO report (title,sql,description) "
-                       "VALUES (%s,%s,%s)", (title, sql, description))
+        cursor.execute("INSERT INTO report (title,query,description) "
+                       "VALUES (%s,%s,%s)", (title, query, description))
         id = db.get_last_id(cursor, 'report')
         db.commit()
         req.redirect(self.env.href.report(id))
@@ -176,11 +176,11 @@
 
         if not req.args.has_key('cancel'):
             title = req.args.get('title', '')
-            sql = req.args.get('sql', '')
+            query = req.args.get('query', '')
             description = req.args.get('description', '')
             cursor = db.cursor()
-            cursor.execute("UPDATE report SET title=%s,sql=%s,description=%s "
-                           "WHERE id=%s", (title, sql, description, id))
+            cursor.execute("UPDATE report SET title=%s,query=%s,description=%s "
+                           "WHERE id=%s", (title, query, description, id))
             db.commit()
         req.redirect(self.env.href.report(id))
 
@@ -204,11 +204,11 @@
     def _render_editor(self, req, db, id, copy=False):
         if id == -1:
             req.perm.assert_permission('REPORT_CREATE')
-            title = sql = description = ''
+            title = query = description = ''
         else:
             req.perm.assert_permission('REPORT_MODIFY')
             cursor = db.cursor()
-            cursor.execute("SELECT title,description,sql FROM report "
+            cursor.execute("SELECT title,description,query FROM report "
                            "WHERE id=%s", (id,))
             row = cursor.fetchone()
             if not row:
@@ -216,7 +216,7 @@
                                      'Invalid Report Number')
             title = row[0] or ''
             description = row[1] or ''
-            sql = row[2] or ''
+            query = row[2] or ''
 
         if copy:
             title += ' (copy)'
@@ -233,7 +233,7 @@
         req.hdf['report.id'] = id
         req.hdf['report.mode'] = 'edit'
         req.hdf['report.title'] = title
-        req.hdf['report.sql'] = sql
+        req.hdf['report.sql'] = query
         req.hdf['report.description'] = description
 
     def _render_view(self, req, db, id):
@@ -426,7 +426,7 @@
             description = 'This is a list of reports available.'
         else:
             cursor = db.cursor()
-            cursor.execute("SELECT title,sql,description from report "
+            cursor.execute("SELECT title,query,description from report "
                            "WHERE id=%s", (id,))
             row = cursor.fetchone()
             if not row:

=== modified file 'trac/upgrades/db17.py'
--- trac/upgrades/db17.py	
+++ trac/upgrades/db17.py	
@@ -2,8 +2,11 @@
 
 def do_upgrade(env, ver, cursor):
     """Rename the columns `kind` and `change` in the `node_change` table for
-    compatibity with MySQL.
+    compatibity with MySQL, as well as the `sql` column in the `reports` table.
     """
+    db_connector, _ = DatabaseManager(env)._get_connector()
+
+    # alter node_change table
     cursor.execute("CREATE TEMP TABLE nc_old AS SELECT * FROM node_change")
     cursor.execute("DROP TABLE node_change")
 
@@ -16,10 +19,26 @@
         Column('base_rev'),
         Index(['rev'])
     ]
-    db_connector, _ = DatabaseManager(env)._get_connector()
     for stmt in db_connector.to_sql(table):
         cursor.execute(stmt)
 
     cursor.execute("INSERT INTO node_change (rev,path,node_type,change_type,"
                    "base_path,base_rev) SELECT rev,path,kind,change,"
                    "base_path,base_rev FROM nc_old")
+
+    # alter report table
+    cursor.execute("CREATE TEMP TABLE report_old AS SELECT * FROM report")
+    cursor.execute("DROP TABLE report")
+
+    table = Table('report', key='id')[
+        Column('id', auto_increment=True),
+        Column('author'),
+        Column('title'),
+        Column('query'),
+        Column('description')
+    ]
+    for stmt in db_connector.to_sql(table):
+        cursor.execute(stmt)
+
+    cursor.execute("INSERT INTO report (id,author,title,query,description) "
+                   "SELECT id,author,title,sql,description FROM report_old")

