Bug #9439 Reporting wrong datatype for sub_part on show index.
Submitted: 29 Mar 2005 0:54 Modified: 28 Apr 2005 1:52
Reporter: Henrik Johnson Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S3 (Non-critical)
Version:4.1.7 OS:Windows (Windows & Linux)
Assigned to: Sergey Petrunya CPU Architecture:Any

[29 Mar 2005 0:54] Henrik Johnson
Description:
The sub_part column is reported as of tiny datatype and yet can return values of up to 1000. This causes an overflow exception when used with the .Net connector since it tries to read this value into a Byte variable.

How to repeat:
Create this table and then describe it. The sub_part datatype reported is tiny (1) and the value returned is 1000.

CREATE TABLE `test_text_pk` (
  `field1` text NOT NULL,
  PRIMARY KEY  (`field1`(1000))
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

Suggested fix:
Change datatype of this describe. For now I've worked around it by always treating Byte as Int16 for the MySQL.Data.
[29 Mar 2005 13:14] MySQL Verification Team
Sorry I don't understood well what you meant: the describe shows
the sub_part data type as tiny.

mysql> describe test_text_pk;
+--------+------+------+-----+---------+-------+
| Field  | Type | Null | Key | Default | Extra |
+--------+------+------+-----+---------+-------+
| field1 | text |      | PRI |         |       |
+--------+------+------+-----+---------+-------+
1 row in set (0.00 sec)
[29 Mar 2005 13:18] MySQL Verification Team
Sorry I didn't noticed your show index:

mysql> show index from test_text_pk\G
*************************** 1. row ***************************
       Table: test_text_pk
  Non_unique: 0
    Key_name: PRIMARY
Seq_in_index: 1
 Column_name: field1
   Collation: A
 Cardinality: 0
    Sub_part: 1000
      Packed: NULL
        Null:
  Index_type: BTREE
     Comment:
1 row in set (0.01 sec)
[16 Apr 2005 18:52] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/24082
[16 Apr 2005 19:04] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/24084
[16 Apr 2005 19:31] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/24086
[17 Apr 2005 16:50] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/24092
[17 Apr 2005 18:20] Sergey Petrunya
Pushed into 4.1.12 tree.
[18 Apr 2005 18:27] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/24119
[28 Apr 2005 1:52] Paul DuBois
Noted in 4.1.12 changelog.