Key over 500 characters fails to error.

Key over 500 characters fails to error.

am 08.09.2002 03:55:27 von cfaber

>Description:
MySQL no longer reports an error on keys larger than
500 characters which results in an errno 138 on the
new table.

I think this is from the latest hack to allow Innodb keys
greater than 500 characters. However this fails to restrict
the length on any other table handler.

>How-To-Repeat:

mysql> CREATE TABLE test (a varchar(255), b varchar(255), c varchar(255), KEY test (a, b, c));
Query OK, 0 rows affected (0.11 sec)

mysql> EXPLAIN test;
ERROR 1016: Can't open file: 'test.MYD'. (errno: 138)
mysql> DROP TABLE test;
Query OK, 0 rows affected (0.11 sec)

mysql> CREATE TABLE test (a varchar(255), b varchar(255), c varchar(255));
Query OK, 0 rows affected (0.10 sec)

mysql> ALTER TABLE test ADD INDEX test (a, b, c);
ERROR 1016: Can't open file: '#sql-139d6_2.MYD'. (errno: 138)

>Fix:
:-)

>Submitter-Id:
>Originator: cfaber
>Organization:
fpsn.net development, Inc.
>MySQL support: none
>Synopsis: Key over 500 characters fails to error.
>Severity: serious
>Priority: high
>Category: mysql
>Class: sw-bug
>Release: mysql-4.0.4-beta-090702 (Source distribution)

>Environment:

System: FreeBSD odysseybox.fpsn.net 4.7-PRERELEASE FreeBSD 4.7-PRERELEASE #0: Thu Sep 5 04:16:25 GMT 2002 cfaber@:/usr/src/sys/compile/ODYSSEYBOX i386


Some paths: /usr/bin/perl /usr/bin/make /usr/local/bin/gmake /usr/bin/gcc /usr/bin/cc
GCC: Using builtin specs.
gcc version 2.95.4 20020320 [FreeBSD]
Compilation info: CC='gcc' CFLAGS='' CXX='c++' CXXFLAGS='' LDFLAGS=''
LIBC:
-r--r--r-- 1 root wheel 1223736 Sep 5 03:37 /usr/lib/libc.a
lrwxr-xr-x 1 root wheel 9 Sep 5 03:37 /usr/lib/libc.so -> libc.so.4
-r--r--r-- 1 root wheel 583832 Sep 5 03:37 /usr/lib/libc.so.4
Configure command: ./configure --without-docs --without-bench --without-innodb --without-isam


------------------------------------------------------------ ---------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail bugs-thread12506@lists.mysql.com
To unsubscribe, e-mail

Key over 500 characters fails to error.

am 10.09.2002 22:42:21 von Michael Widenius

Hi!

>>>>> "cfaber" == cfaber writes:

>> Description:
cfaber> MySQL no longer reports an error on keys larger than
cfaber> 500 characters which results in an errno 138 on the
cfaber> new table.

cfaber> I think this is from the latest hack to allow Innodb keys
cfaber> greater than 500 characters. However this fails to restrict
cfaber> the length on any other table handler.

>> How-To-Repeat:



>> Fix:

Thanks for the test case.
Here is a fix for this:

((/my/mysql-4.0)) bk diffs -c sql/sql_table.cc
===== sql/sql_table.cc 1.129 vs edited =====
*** /tmp/sql_table.cc-1.129-2111 Tue Sep 3 18:02:04 2002
--- edited/sql/sql_table.cc Wed Sep 11 00:12:21 2002
***************
*** 627,633 ****
if (!(key_info->flags & HA_NULL_PART_KEY))
unique_key=1;
key_info->key_length=(uint16) key_length;
! uint max_key_length= max(file->max_key_length(), MAX_KEY_LENGTH);
if (key_length > max_key_length && key->type != Key::FULLTEXT)
{
my_error(ER_TOO_LONG_KEY,MYF(0),max_key_length);
--- 627,633 ----
if (!(key_info->flags & HA_NULL_PART_KEY))
unique_key=1;
key_info->key_length=(uint16) key_length;
! uint max_key_length= min(file->max_key_length(), MAX_KEY_LENGTH);
if (key_length > max_key_length && key->type != Key::FULLTEXT)
{
my_error(ER_TOO_LONG_KEY,MYF(0),max_key_length);

Regards,
Monty

------------------------------------------------------------ ---------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail bugs-thread12525@lists.mysql.com
To unsubscribe, e-mail