[odb-users] UTF-8 character set issue in schema_version table

Boris Kolpackov boris at codesynthesis.com
Thu Apr 6 12:31:29 EDT 2017


Hi Henri,

Henri Schwarz <il1k3pepsi at gmail.com> writes:

> `name` VARCHAR(255) NOT NULL PRIMARY KEY,
>
> [...]
> 
> *ERROR 1071 (42000) at line 13: Specified key was too long; max key length
> is 767 bytes*
>
> [...]
>
> | character_set_database   | utf8mb4                    |

The utf8mb4 is the issue. This means MySQL uses 4 bytes per character
instead of 3 as was the case I guess until recently (that's where 255
comes from: 767/3).

I've fixed this for the next release (now the default is 128 in case
MySQL folks decide to use 5 bytes next week ;-)). Your options are
as follows:

1. Change the database from utf8mb4 to utf8mb3.

2. Create a suitable schema_version table manually before calling the
   create_schema() function (which will omit creating it because of the
   IF NOT EXISTS clause).

3. I can build you a pre-release version of ODB with the fix.

Let me know if you are interested in #3.

Boris



More information about the odb-users mailing list