On Wed, 2009-01-07 at 20:49 +0530, Rama wrote: > i have a model as below (please follow the red color lines) > > class NewsEntry(models.Model) : > url = models.URLField(max_length=1024,db_index=True) > title = models.CharField(max_length=1024) > > ------------- > thereafter i ran > python manage.py syncdb > > i am getting the following error > Failed to install index for pystories.NewsEntry model: Specified > key was too long; max key length is 767 bytes
That result is going to be database server specific and possibly also dependent upon whether you specified the table or database as accepting UTF-8 encoded strings or just plain ASCII. So which database are you using? [...] > But As per the requirement URL should be of length 1024 > so what did is ? > 1) kept the length to 1024 A URLfield is just a character field and since you also create a character field of the same length without an index and it worked, that would seem to rule out this possibility. > 2) Executed the following command on database > CREATE INDEX urlindex ON pystories_newsentry(url(255)); > > ------------------------ > Can i specify the same thing (i.e) creation of index on URL(255) > instead of 1024 in model class NewsEntry itself instead of going > to database and running the command (CREATE INDEX urlindex ON > pystories_newsentry(url(255));) ? No, you can't. Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

