flask-session icon indicating copy to clipboard operation
flask-session copied to clipboard

Varchar prefix may cause problems when using MySQL with unicode.

Open Junzki opened this issue 10 years ago • 1 comments

The character limit depends on the character set. For example if you use latin1 then the largest column you can index is varchar(767), but if you use utf8 then the limit is varchar(255).

In sessions.py, the attribute session_id of class SqlAlchemySessionInterface is set to 256, however, when my database collection is set to utf8, it may cause a problen like this:

 1071, 'Specified key was too long; max key length is 767 bytes'  

And I change it to 255, the problem is solved.

Junzki avatar Jun 22 '15 17:06 Junzki

@Junzki looks like this was fixed in a different pr.

christopherpickering avatar Aug 17 '22 17:08 christopherpickering