[TYPO3-UG Russia] 4.1.1, mysql5 и длина ключа

Michael Shigorin mike at osdn.org.ua
Tue Jun 5 17:48:39 CEST 2007


	Здравствуйте.
При поднятии новенькой 4.1.1 (пакет стряпаю) на php5/mysql5 
наблюдаю в DB Analyser такой несгораемый остаток:

CREATE TABLE sys_refindex ( hash varchar(64) NOT NULL default '', tablename varchar(80) NOT NULL default '', recuid int(11) NOT NULL default '0', field varchar(80) NOT NULL default '', flexpointer text NOT NULL, softref_key varchar(60) NOT NULL default '', softref_id varchar(80) NOT NULL default '', sorting int(11) NOT NULL default '0', deleted tinyint(1) NOT NULL default '0', ref_table varchar(80) NOT NULL default '', ref_uid int(11) NOT NULL default '0', ref_string text NOT NULL, PRIMARY KEY (hash), KEY lookup_rec (tablename,recuid), KEY lookup_uid (ref_table,ref_uid), KEY lookup_string (ref_table,ref_string(400)));

(множитель размера полей выставлен в 2, т.к. предполагается utf-8)

MySQL ругается на него так:

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

mysql'щики пишут вот что:

--- http://bugs.mysql.com/bug.php?id=6604
"Prefixes can be up to 255 bytes long (or 1000 bytes for MyISAM
and InnoDB tables as of MySQL 4.1.2). Note that prefix limits are
measured in bytes, whereas the prefix length in CREATE INDEX
statements is interpreted as number of characters. Take this into
account when specifying a prefix length for a column that uses a
multi-byte character set."

You are correct, it is the utf8 that is causing the extra bytes.
Try creating the table this way:

CREATE TABLE phpgw_lang (
lang varchar(5) NOT NULL DEFAULT '',
app_name varchar(100) NOT NULL DEFAULT 'common',
message_id varchar(255) NOT NULL DEFAULT '',
content text,
PRIMARY KEY(lang,app_name(75),message_id(100))
);

This will index the first 75 and 100 chars from the columns which
should work and be faster in general as well.
---

Заменил 400 на 200 (с 300 в сумме всё равно не влазило) -- OK.

Может, посмотреть вопрос и поправить в исходном .sql для 4.1.2+?

PS: упс, и с admin:password в BE чегой-то не пускает...
пришлось руками состряпать из install tool.  Ну да ладно.

-- 
 ---- WBR, Michael Shigorin <mike at altlinux.ru>
  ------ Linux.Kiev http://www.linux.kiev.ua/


More information about the TYPO3-russia mailing list