diff options
author | unknown <osku@127.(none)> | 2005-09-23 11:20:34 +0300 |
---|---|---|
committer | unknown <osku@127.(none)> | 2005-09-23 11:20:34 +0300 |
commit | 6fbbb1d5be323d08e622a018001453b49d8a0248 (patch) | |
tree | ce6530b960229fcd168e9501f71caeccf13beec7 /sql | |
parent | d2fc3bd4245f8c212046e88151da4a66d1b048b3 (diff) | |
download | mariadb-git-6fbbb1d5be323d08e622a018001453b49d8a0248.tar.gz |
InnoDB: Fix bug #13315, index columns having a maximum length of 767.
innobase/data/data0data.c:
Adapt to DICT_MAX_COL_PREFIX_LEN rename.
innobase/dict/dict0dict.c:
Adapt to DICT_MAX_COL_PREFIX_LEN rename.
innobase/include/dict0mem.h:
Rename DICT_MAX_COL_PREFIX_LEN to DICT_MAX_INDEX_COL_LEN.
innobase/include/row0mysql.h:
Add field_lengths parameter to row_create_index_for_mysql.
innobase/rem/rem0rec.c:
Adapt to DICT_MAX_COL_PREFIX_LEN rename.
innobase/row/row0mysql.c:
Add field_lengths parameter to row_create_index_for_mysql and use it to
check for too long index columns.
mysql-test/r/innodb.result:
New tests.
mysql-test/t/innodb.test:
New tests.
sql/ha_innodb.cc:
Create temporary field_lengths buffer and pass it to
row_create_index_for_mysql.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/ha_innodb.cc | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 9e10873ad63..007194e09b3 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -4492,7 +4492,8 @@ create_index( ulint is_unsigned; ulint i; ulint j; - + ulint* field_lengths; + DBUG_ENTER("create_index"); key = form->key_info + key_num; @@ -4514,6 +4515,10 @@ create_index( index = dict_mem_index_create((char*) table_name, key->name, 0, ind_type, n_fields); + + field_lengths = (ulint*) my_malloc(sizeof(ulint) * n_fields, + MYF(MY_FAE)); + for (i = 0; i < n_fields; i++) { key_part = key->key_part + i; @@ -4568,6 +4573,8 @@ create_index( prefix_len = 0; } + field_lengths[i] = key_part->length; + /* We assume all fields should be sorted in ascending order, hence the '0': */ @@ -4576,10 +4583,12 @@ create_index( 0, prefix_len); } - error = row_create_index_for_mysql(index, trx); + error = row_create_index_for_mysql(index, trx, field_lengths); error = convert_error_code_to_mysql(error, NULL); + my_free((gptr) field_lengths, MYF(0)); + DBUG_RETURN(error); } @@ -4602,7 +4611,7 @@ create_clustered_index_when_no_primary( index = dict_mem_index_create((char*) table_name, (char*) "GEN_CLUST_INDEX", 0, DICT_CLUSTERED, 0); - error = row_create_index_for_mysql(index, trx); + error = row_create_index_for_mysql(index, trx, NULL); error = convert_error_code_to_mysql(error, NULL); |