View Issue Details

IDProjectCategoryView StatusLast Update
0004105SOGoBackend Generalpublic2017-03-29 14:22
Reporterzhb Assigned Toludovic  
PriorityhighSeverityminorReproducibilityalways
Status closedResolutionno change required 
Product Version3.2.8 
Summary0004105: SOGo cannot create sql table for OCSCacheFolder with MySQL 5.1.73 on CentOS 6.
Description

Dear developers,

I'm running SOGo 3.2.8 (and old releases) on CentOS 6.x with MySQL 5.1.73 (the one shipped by CentOS), it creates other SQL tables, but cannot create SQL table for OCSCacheFolder.

Here's the tables created by SOGo automatically:

############

mysql sogo -e "show tables"

+------------------------+
| Tables_in_sogo |
+------------------------+
| sogo_acl |
| sogo_alarms_folder |
| sogo_folder_info |
| sogo_quick_appointment |
| sogo_quick_contact |
| sogo_sessions_folder |
| sogo_store |
| sogo_user_profile |
| users | # <- This one is SQL VIEW, created manually.
+------------------------+
##################

This is the original SQL template from SOGo package (/usr/lib64/GNUstep/SOGo/MainUI.SOGo/Resources/OCSCacheFolder-mysql.sql):

###################################

-- (C) 2004-2005 SKYRIX Software AG
-- (C) 2006-2007 Inverse inc.

CREATE TABLE @{tableName} (
c_uid VARCHAR(255) NOT NULL,
c_path VARCHAR(255) NOT NULL,
c_parent_path VARCHAR(255),
c_type TINYINT UNSIGNED NOT NULL,
c_creationdate INT NOT NULL,
c_lastmodified INT NOT NULL,
c_version INT NOT NULL DEFAULT 0,
c_deleted TINYINT NOT NULL DEFAULT 0,
c_content LONGTEXT,
CONSTRAINT @{tableName}_pkey PRIMARY KEY (c_uid, c_path)
);
###################################

I replaced @{tableName} by the real sql table name "sogo_cache_folder", then import it manually:

mysql sogo < OCSCacheFolder-mysql.sql

ERROR 1071 (42000) at line 6: Specified key was too long; max key length is 1000 bytes

SOGo database was created with UTF8 character set:

#############################
mysql> show create database sogo;
+----------+---------------------------------------------------------------+
| Database | Create Database |
+----------+---------------------------------------------------------------+
| sogo | CREATE DATABASE sogo /!40100 DEFAULT CHARACTER SET utf8 / |
+----------+---------------------------------------------------------------+
#############################

TagsNo tags attached.

Activities

zhb

zhb

2017-03-25 09:58

reporter   ~0011578

UPDATE: If i create sogo database with default character set (not 'UTF8'), it works.

Christian Mack

Christian Mack

2017-03-27 08:48

developer   ~0011585

Not surprising, as a character in UTF-8 is 4 Bytes long, an ISO-8859-1 is 1 Byte per character.
Therefore:
2 255 ISO-8859-1 = 500 Bytes
2
255 UTF-8 = 2000 Bytes

zhb

zhb

2017-03-27 15:02

reporter   ~0011592

Understood. Please mention this in SOGo installation guide. otherwise others MAY experience same error.

Christian Mack

Christian Mack

2017-03-27 16:18

developer   ~0011594

That primary key should be changed.
Something like:

CONSTRAINT @{tableName}_pkey PRIMARY KEY (c_uid(100), c_path(100))

IIRC with that it only uses the first 100 characters out of the c_uid and c_path fields for the key.
Perhaps that is sufficient.
Or the length of c_uid and c_path must be shorter.

zhb

zhb

2017-03-27 17:26

reporter   ~0011596

Which one is better? Create sql db in latin (by me), or modify SQL table (by SOGo)?

Christian Mack

Christian Mack

2017-03-28 09:03

developer   ~0011602

UTF-8 can handle non latin characters way better.
Therefore I think this should be fixed in SOGo.

zhb

zhb

2017-03-28 14:27

reporter   ~0011606

Hi Christian,

Any plan to fix it in SOGo?

ludovic

ludovic

2017-03-29 13:35

administrator   ~0011615

Nothing can be done in SOGo for this.

MySQL 5.1 is ancient stuff now, released 13 years ago.

MySQL 5.5 supports much larger keys length. See the documentation about "5.9.1. MySQL complete Unicode compliance" in SOGo docs.

zhb

zhb

2017-03-29 14:20

reporter   ~0011622

OK, if SOGo team has no plan to "fix" it, i will do some work to handle this in iRedMail installer. Thanks for the update.

I think we can close this ticket now.

ludovic

ludovic

2017-03-29 14:22

administrator   ~0011623

It's not that we have no plan to fix it - it's that we cannot fix it. We use large identifiers everywhere in SOGo, that would mean we would need to change everything in SOGo.

Issue History

Date Modified Username Field Change
2017-03-25 09:31 zhb New Issue
2017-03-25 09:58 zhb Note Added: 0011578
2017-03-27 08:48 Christian Mack Note Added: 0011585
2017-03-27 15:02 zhb Note Added: 0011592
2017-03-27 16:18 Christian Mack Note Added: 0011594
2017-03-27 17:26 zhb Note Added: 0011596
2017-03-28 09:03 Christian Mack Note Added: 0011602
2017-03-28 14:27 zhb Note Added: 0011606
2017-03-29 13:33 ludovic Severity crash => minor
2017-03-29 13:35 ludovic Note Added: 0011615
2017-03-29 14:20 zhb Note Added: 0011622
2017-03-29 14:22 ludovic Note Added: 0011623
2017-03-29 14:22 ludovic Status new => closed
2017-03-29 14:22 ludovic Assigned To => ludovic
2017-03-29 14:22 ludovic Resolution open => no change required