#31144: MySQL unique constraints incorrectly limited to 255 char when it should 
be
1000
-------------------------------------+-------------------------------------
               Reporter:  Steven     |          Owner:  nobody
  Mapes                              |
                   Type:  Bug        |         Status:  new
              Component:  Database   |        Version:  3.0
  layer (models, ORM)                |       Keywords:  MySQL, MAriaDB,
               Severity:  Normal     |  Unique
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 There is a bug within db.backends.mysql.validation.check_field_type where
 the maximum unique constraints is still being limited to 255 characters
 even though MySQL supports unique keys of up to 1000 characters by default
 and InnoDB supports 3072 bytes for InnoDB tables that use DYNAMIC or
 COMPRESSED row format and 767 bytes for InnoDB tables that use the
 REDUNDANT or COMPACT row format.

 Reference  -
 InnoDB - https://dev.mysql.com/doc/refman/8.0/en/innodb-limits.html

 MyISAM - https://dev.mysql.com/doc/refman/8.0/en/myisam-storage-
 engine.html

 Example

 CREATE DATABASE `test`CHARACTER SET utf8 COLLATE utf8_general_ci;
 USE test;
 {{{
 CREATE TABLE `example_innodb` (
   `example1` VARCHAR(1024) DEFAULT NULL,
   `example2` VARCHAR(1024) DEFAULT NULL,
   UNIQUE KEY `UQ_example1` (`example1`),
   UNIQUE KEY `UQ_example2` (`example2`)
 ) ENGINE=INNODB DEFAULT CHARSET=utf8

 DROP TABLE example_innodb;
 DROP DATABASE test;
 }}}

 It just needs the max length to be increased on line 38 of
 db.backends.mysql.validation

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31144>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/054.620342e47c464091d1bfd8f008a4e070%40djangoproject.com.

Reply via email to