Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DatabaseError: (1170, "BLOB/TEXT column 'tree_path' used in key specification without a key length") #48

Closed
byrnenick opened this issue Aug 27, 2013 · 9 comments

Comments

@byrnenick
Copy link

We are getting the following error when running south migrations after implementing threadedcomments. I see a much older bug like this logged, and the problem at that time was Django indexing. Has this been resolved since?

@byrnenick
Copy link
Author

This had something to do with the use of the text model field for tree_path. I resolved it by changing its type to CharField(max_length=255) - in theory you should be able to use any length you like though.

@falkolab
Copy link

The error is coming because MySQL can index only the first N chars of a BLOB or TEXT column. So you must be having a field/column type of TEXT or BLOB that you are trying to make as primary key or index.

With full BLOB or TEXT without the length value, MySQL will be unable to guarantee the uniqueness of the column as it’s of variable and dynamic size. So, when using BLOB or TEXT types as index, the value of N must be supplied so that MySQL can determine the key length.

@byrnenick
Copy link
Author

I saw this, it looked like ThreadedComments module was doing this? The error was around the ThreadedComments - Tree_path field?

@falkolab
Copy link

falkolab commented Sep 2, 2013

Exactly, with regard to mysql

@gawel
Copy link

gawel commented Jan 31, 2014

Same issue here

@bee-keeper
Copy link

Same issue here with mysql. Is it fair to say this package is broken for mysql users? I tried changing the tree_path to CharField(max_length=255) but that produces this warning:

Failed to install index for threadedcomments.ThreadedComment model: Duplicate index 'threadedcomments_comment_05bb2fd1' defined on the table 'iw.threadedcomments_comment'. This is deprecated and will be disallowed in a future release.

Edit: Have gone for a custom solution as I can't work out what's going wrong and I don't want problems down the line.

@jpatel3
Copy link

jpatel3 commented Jul 9, 2014

I am running into the same issue when trying to run the test for the app -

FATAL ERROR - The following SQL query failed: CREATE INDEX threadedcomments_comment_928d31e4 ON threadedcomments_comment (tree_path);
The error was: (1170, "BLOB/TEXT column 'tree_path' used in key specification without a key length")
! Error found during real run of migration! Aborting.

any solution for this?

@phiychai
Copy link

phiychai commented Nov 6, 2014

I'm having the same issue too.

@vdboor
Copy link
Collaborator

vdboor commented Apr 14, 2015

This is now fixed in django-threadedcomments 1.0b1. We've replaced the TextField with a CharField, that MySQL can apply indexes at.

@vdboor vdboor closed this as completed Apr 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants