Opened 8 years ago

Closed 5 years ago

#7731 closed defect (fixed)

error on 'trac-admin upgrade': "BLOB/TEXT column 'milestone' used in key specification without a key length"

Reported by: emparq@… Owned by: Ryan J Ollos
Priority: normal Component: ExtendedVersionPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11


Hello, I've just recently tried to install this plugin on a trac 11.5, and the 'trac-admin <path> upgrade' reported this error:

[mike@localhost:~/temp/extendedversionplugin/0.11]$ sudo trac-admin
/var/www/trac/dev_projects upgrade
Traceback (most recent call last):
 File "/usr/bin/trac-admin", line 7, in ?
 File "/usr/lib/python2.4/site-packages/Trac-0.11.5-py2.4.egg/trac/admin/",
line 1314, in run
   return admin.onecmd(command)
 File "/usr/lib/python2.4/site-packages/Trac-0.11.5-py2.4.egg/trac/admin/",
line 133, in onecmd
   rv = cmd.Cmd.onecmd(self, line) or 0
 File "/usr/lib64/python2.4/", line 219, in onecmd
   return func(arg)
 File "/usr/lib/python2.4/site-packages/Trac-0.11.5-py2.4.egg/trac/admin/",
line 1154, in do_upgrade
 File "/usr/lib/python2.4/site-packages/Trac-0.11.5-py2.4.egg/trac/",
line 457, in upgrade
 File "/usr/lib/python2.4/site-packages/ExtendedVersionTracPlugin-0.0-py2.4.egg/extendedversion/",
line 47, in upgrade_environment
 File "/usr/lib/python2.4/site-packages/Trac-0.11.5-py2.4.egg/trac/db/",
line 60, in execute
   return self.cursor.execute(sql)
 File "build/bdist.linux-x86_64/egg/MySQLdb/", line 173, in execute
 File "build/bdist.linux-x86_64/egg/MySQLdb/", line 36,
in defaulterrorhandler
_mysql_exceptions.OperationalError: (1170, "BLOB/TEXT column
'milestone' used in key specification without a key length")

I'm still trying to decide where to begin troubleshooting, so I thought I'd ask first. Is this a known issue?

System Information:

Trac:	0.11.5
Python:	2.4.3 (#1, Sep 3 2009, 15:37:37) [GCC 4.1.2 20080704 (Red Hat 4.1.2-46)]
setuptools:	0.6c11
MySQL:	server: "5.0.77-log", client: "5.0.77", thread-safe: 0
MySQLdb:	1.2.3c1
Genshi:	0.5.1
mod_python:	3.2.8
Subversion:	1.4.2 (r22196)
jQuery:	1.2.6

Attachments (0)

Change History (5)

comment:1 Changed 8 years ago by Malcolm Studd

I'm guessing you're the first person to try the plugin with MySQL. It looks like MySQL is breaking on 'name text PRIMARY KEY' because it expects some sort of length specifier for the primary key.

I guess the code needs to figure out the type of database and change the SQL. Ugh.

For now, try changing the table definition in to

        """CREATE TABLE milestone_version (
            milestone    text,
            version      text,
            PRIMARY KEY milestone(100)

Hopefully that's valid syntax for MySQL.

comment:2 Changed 8 years ago by emparq@…

Yes, that last line did the trick- thanks!

comment:3 Changed 7 years ago by jonathan.pletschke@…

The above SQL change did not work for me. I resolved the issue by using the following on my MySQL installation:

create table milestone_version ( milestone text, PRIMARY KEY (milestone(100)), version text ) ENGINE=InnoDB;

This was done in the MySQL command interpreter. I'm using the InnoDB engine on the Trac tables hence the last table option. The create table statement would then have caused a problem so I simply commented it out altogether.

Made an entry in my Trac wiki to reflect this hack. Just so future maintainers know what happens :-)

comment:4 Changed 5 years ago by Ryan J Ollos

Owner: changed from Malcolm Studd to Ryan J Ollos

I believe that if we use the Table, Column and Index classes from trac.db.schema, then the Trac database API will handle the cross-database compatibility issues.

comment:5 Changed 5 years ago by Ryan J Ollos

Resolution: fixed
Status: newclosed

In 13318:

Improve cross-db compatibility (Fixes #7731).

Use Table and Column from the trac.db.schema to define the database schema, thereby letting the Trac API handle cross-DB compatibility issues.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.