pallets-eco / flask-session

Server side session extension for Flask
https://flask-session.readthedocs.io
BSD 3-Clause "New" or "Revised" License
501 stars 239 forks source link

fixed 'Specified key was too long; max key length is 767 bytes' with InnoDB/UTF-8 #35

Closed skazi0 closed 7 years ago

skazi0 commented 8 years ago

When default table settings for the DB are InnoDB+UTF-8, VARCHAR(256) fields require 768 bytes for the UNIQE index key which is above the MySQL limit of 767 bytes. Lowering session_id field length to 255 chars is enough to fix this.

More details on the index limits in MySQL can be found here: http://stackoverflow.com/questions/1814532/1071-specified-key-was-too-long-max-key-length-is-767-bytes/16820166#16820166

revmischa commented 7 years ago

Why is this even a varchar? This is dumb for postgres. Just make it TEXT.