[MDEV-18712] InnoDB indexes are inconsistent with what defined in .frm for table after rebuilding table with index on blob Created: 2019-02-24  Updated: 2019-02-28  Resolved: 2019-02-28

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Alter Table, Data types
Affects Version/s: 10.4
Fix Version/s: 10.4.4

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Problem/Incident
is caused by MDEV-371 Unique indexes for blobs Closed

 Description   

Note: The failure became possible after MDEV-371, without it ALTER is rejected due to the missing length in the key definition.

--source include/have_innodb.inc
 
CREATE TABLE t1 (b BLOB) ENGINE=InnoDB;
ALTER TABLE t1 ADD INDEX(b);
ALTER TABLE t1 FORCE;
 
# Cleanup
DROP TABLE t1;

10.4 fb01193c

2019-02-24  3:24:53 9 [ERROR] Found index b whose column info does not match that of MariaDB.
2019-02-24  3:24:53 9 [ERROR] InnoDB indexes are inconsistent with what defined in .frm for table ./test/t1
^ Found warnings in /dev/shm/var/log/mysqld.1.err



 Comments   
Comment by Sachin Setiya (Inactive) [ 2019-02-24 ]

Actually Only UNIQUE key is supported on long columns , So I think It is bug I should not be able to create index on long columns, Thins patch will solve the bug

diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index edd0b95fca0..c4b47f8290c 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -3941,13 +3941,13 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
             column->length= MAX_LEN_GEOM_POINT_FIELD;
           if (!column->length)
           {
-            if (key->type == Key::PRIMARY)
+            if (key->type == Key::UNIQUE)
+              is_hash_field_needed= true;
+            else
             {
               my_error(ER_BLOB_KEY_WITHOUT_LENGTH, MYF(0), column->field_name.str);
               DBUG_RETURN(TRUE);
             }
-            else
-              is_hash_field_needed= true;
           }
         }
 #ifdef HAVE_SPATIAL

Generated at Thu Feb 08 08:46:10 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.