Opened 3 years ago

Closed 23 months ago

#21196 closed Bug (fixed)

Warning when running the test suite under MySQL

Reported by: aaugustin Owned by: tchaumeny
Component: contrib.admin Version: master
Severity: Normal Keywords:
Cc: t.chaumeny@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Failed to install index for admin_views.PrePopulatedPostLargeSlug model: Specified key was too long; max key length is 767 bytes

Unfortunately, python -Werror doesn't display a traceback.

Change History (4)

comment:1 Changed 2 years ago by afuna

python -Walways ./ gives me django/db/backends/mysql/ Warning: Specified key was too long; max key length is 767 bytes

I'd be happy to dig into this more, but I'm not sure what desired behavior is. Is it to silence the warning, turn it into an exception, adjust the test, or something else? :)

comment:2 Changed 23 months ago by tchaumeny

  • Cc t.chaumeny@… added
  • Has patch set
  • Owner changed from nobody to tchaumeny
  • Status changed from new to assigned

I encountered the same problem when trying to run the test suite under MySQL. It looks like MySQL doesn't support indexing VARCHAR fields with a length of 767+ on InnoDB tables (see #15938 introduced a SlugField on a field with max_length = 1000 for a test. sets db_index=False, which solves the problem.

comment:3 Changed 23 months ago by loic

Indeed, quoting the docs:

"Prefix support and lengths of prefixes (where supported) are storage engine dependent. For example, a prefix can be up to 1000 bytes long for MyISAM tables, and 767 bytes for InnoDB tables."

Last edited 23 months ago by loic (previous) (diff)

comment:4 Changed 23 months ago by Loic Bistuer <loic.bistuer@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

In 825ea8385857a98a36b3dc67c427b0000b5d9112:

Fixed #21196 -- Removed index on test field causing MySQL specific warning.

Note: See TracTickets for help on using tickets.
Back to Top