diff options
author | unknown <monty@mysql.com> | 2004-12-31 11:56:50 +0200 |
---|---|---|
committer | unknown <monty@mysql.com> | 2004-12-31 11:56:50 +0200 |
commit | 7ea744f723f819480a253c95533a8c258bc4925c (patch) | |
tree | 6bb018bc0c482575e5fb2e8831e5b2b07e5e2ef4 /sql | |
parent | c4c2c7bceb3a427fe669bfeec6747a72e404e1ad (diff) | |
download | mariadb-git-7ea744f723f819480a253c95533a8c258bc4925c.tar.gz |
Fix max_key_length and max_unique_length to take into account varchar and null extra lengths
This fixes a bug found by bdb.test
Fixes a portability issue with bdb tables
mysql-test/include/varchar.inc:
Fix test to be reproducable
(Either key v or v_2 could be used here)
mysql-test/r/bdb.result:
Fix test to be reproducable
(Either key v or v_2 could be used here)
mysql-test/r/myisam.result:
Fix test to be reproducable
(Either key v or v_2 could be used here)
sql/table.cc:
Fix max_key_length and max_unique_length to take into account varchar and null extra lengths
This fixes a bug found by bdb.test
Diffstat (limited to 'sql')
-rw-r--r-- | sql/table.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sql/table.cc b/sql/table.cc index 8a85eb95fdc..efc27a964c7 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -262,11 +262,6 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, } key_part->store_length=key_part->length; } - set_if_bigger(outparam->max_key_length,keyinfo->key_length+ - keyinfo->key_parts); - outparam->total_key_length+= keyinfo->key_length; - if (keyinfo->flags & HA_NOSAME) - set_if_bigger(outparam->max_unique_length,keyinfo->key_length); } keynames=(char*) key_part; strpos+= (strmov(keynames, (char *) strpos) - keynames)+1; @@ -718,6 +713,12 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, } } keyinfo->usable_key_parts=usable_parts; // Filesort + + set_if_bigger(outparam->max_key_length,keyinfo->key_length+ + keyinfo->key_parts); + outparam->total_key_length+= keyinfo->key_length; + if (keyinfo->flags & HA_NOSAME) + set_if_bigger(outparam->max_unique_length,keyinfo->key_length); } if (primary_key < MAX_KEY && (outparam->keys_in_use.is_set(primary_key))) |