On Monday 24 September 2012 18:14:11 Andreas Schneider wrote:
> On Monday 24 September 2012 18:02:06 Andreas Schneider wrote:
> > On Monday 24 September 2012 18:00:16 Andreas Schneider wrote:
> > > Hello,
> > > 
> > > I get the following error:
> > > 
> > > {"app":"core","message":"Failed to update database structure (MDB2
> > > Error:
> > > unknown error, _doQuery: [Error message: Could not execute
> > > statement]\n[Last executed query: CREATE INDEX
> > > `appconfig_appid_key_index` ON `cld_appconfig` (`appid`,
> > > `configkey`)]\n[Native code: 1071]\n[Native message: Specified key was
> > > too long; max key length is 1000
> > > bytes]\n)","level":4,"time":1348502048}
> > > 
> > > The reason for this is cause appid and configkey are varchar(255) and
> > > you
> > > can't index them cause they are two big.
> > > 
> > > See http://bugs.mysql.com/bug.php?id=4541
> > > 
> > > Why needs the appid to be such a big key? Same for the configkey ...
> > 
> > Same for the preferences table with userid, appid and configkey and for
> > sure others.
> 
> In one table the userid is 200 then in the next 100 and 255. This will
> probably not work out.
> 
> 
> Please choose sane values. Suggestions:
> 
> userid 32 chars (who really chooses a username longer than that?)
> appid 32 chars (my_super_duper_mega_cool_app_which_does_nothing is for
>                 sure not a good choice.)
> configkey 64 chars (maybe more)
> 

Patch attached.

> 
> 
>       -- andreas
-- 
Andreas Schneider                   GPG-ID: F33E3FC6
www.cryptomilk.org                [email protected]
>From 0161f6d4e78183e8b6f15f5a6db9ae147e299563 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <[email protected]>
Date: Mon, 24 Sep 2012 18:15:33 +0200
Subject: [PATCH] Fix bug with mysql index exceeding 1000bytes.

If you use UTF8 then a char is 3 bytes and with insane big values for
indexes you exceed the maximum for key indexes.

See http://bugs.mysql.com/bug.php?id=4541

This chooses sane value sand make sure we use existant values trough the
database.

Signed-off-by: Andreas Schneider <[email protected]>
---
 db_structure.xml | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/db_structure.xml b/db_structure.xml
index b1e620f..94c331c 100644
--- a/db_structure.xml
+++ b/db_structure.xml
@@ -18,7 +18,7 @@
 				<type>text</type>
 				<default></default>
 				<notnull>true</notnull>
-				<length>255</length>
+				<length>32</length>
 			</field>
 
 			<field>
@@ -26,7 +26,7 @@
 				<type>text</type>
 				<default></default>
 				<notnull>true</notnull>
-				<length>255</length>
+				<length>64</length>
 			</field>
 
 			<field>
@@ -310,7 +310,7 @@
 				<type>text</type>
 				<default></default>
 				<notnull>false</notnull>
-				<length>200</length>
+				<length>64</length>
 			</field>
 
 			<field>
@@ -318,7 +318,7 @@
 				<type>text</type>
 				<default></default>
 				<notnull>false</notnull>
-				<length>100</length>
+				<length>64</length>
 			</field>
 
 			<field>
@@ -379,7 +379,7 @@
 				<type>text</type>
 				<default></default>
 				<notnull>true</notnull>
-				<length>255</length>
+				<length>64</length>
 			</field>
 
 			<field>
@@ -387,7 +387,7 @@
 				<type>text</type>
 				<default></default>
 				<notnull>true</notnull>
-				<length>255</length>
+				<length>32</length>
 			</field>
 
 			<field>
@@ -395,7 +395,7 @@
 				<type>text</type>
 				<default></default>
 				<notnull>true</notnull>
-				<length>255</length>
+				<length>64</length>
 			</field>
 
 			<field>
@@ -435,7 +435,7 @@
 				<type>text</type>
 				<default></default>
 				<notnull>true</notnull>
-				<length>200</length>
+				<length>64</length>
 			</field>
 
 			<field>
-- 
1.7.12

_______________________________________________
Owncloud mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/owncloud

Reply via email to