Bug #41030 Wrong meta data (incorrect fieldlen)
Submitted: 25 Nov 2008 19:42 Modified: 19 Mar 2009 3:36
Reporter: Georg Richter Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:5.1.31/6.0.9 OS:Linux
Assigned to: Sergei Glukhov CPU Architecture:Any
Tags: regression

[25 Nov 2008 19:42] Georg Richter
Description:
When retrieving variables the length value in metadata information is wrong. This works fine with 5.0.74.

How to repeat:
/usr/local/mysql/bin/mysql -uroot --column-type-info

mysql> select @@version;
Field   1:  `@@version`
Catalog:    `def`
Database:   ``
Table:      ``
Org_table:  ``
Type:       VAR_STRING
Collation:  latin1_swedish_ci (8)
Length:     5592405
Max_length: 12
Decimals:   31
Flags:      NOT_NULL

+--------------+
| @@version    |
+--------------+
| 5.1.31-debug |
+--------------+
1 row in set (0.00 sec)
[25 Nov 2008 20:30] MySQL Verification Team
Thank you for the bug report.

c:\dbs>5.1\bin\mysql -uroot --port=3510 --column-type-info
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.31-nt-debug-log Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> select @@version;
Field   1:  `@@version`
Catalog:    `def`
Database:   ``
Table:      ``
Org_table:  ``
Type:       VAR_STRING
Collation:  latin1_swedish_ci (8)
Length:     5592405
Max_length: 19
Decimals:   31
Flags:      NOT_NULL

+---------------------+
| @@version           |
+---------------------+
| 5.1.31-nt-debug-log |
+---------------------+
1 row in set (0.00 sec)

c:\dbs>5.0\bin\mysql -uroot --port=3500 -T
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.74-nt-debug-log Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> select @@version;
Field   1:  `@@version`
Catalog:    `def`
Database:   ``
Table:      ``
Org_table:  ``
Type:       VAR_STRING
Collation:  latin1_swedish_ci (8)
Length:     19
Max_length: 19
Decimals:   31
Flags:      NOT_NULL

+---------------------+
| @@version           |
+---------------------+
| 5.0.74-nt-debug-log |
+---------------------+
1 row in set (0.00 sec)

c:\dbs>6.0\bin\mysql -uroot --port=3600 --column-type-info
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 6.0.9-alpha-nt-debug-log Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> select @@version;
Field   1:  `@@version`
Catalog:    `def`
Database:   ``
Table:      ``
Org_table:  ``
Type:       VAR_STRING
Collation:  latin1_swedish_ci (8)
Length:     4194304
Max_length: 24
Decimals:   31
Flags:      NOT_NULL

+--------------------------+
| @@version                |
+--------------------------+
| 6.0.9-alpha-nt-debug-log |
+--------------------------+
1 row in set (0.00 sec)

mysql>

C:\temp\mysql-5.1.22-rc-win32>bin\mysql -uroot --column-type-info
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.22-rc-community MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> select @@version;
Field   1:  `@@version`
Catalog:    `def`
Database:   ``
Table:      ``
Org_table:  ``
Type:       VAR_STRING
Collation:  latin1_swedish_ci (8)
Length:     19
Max_length: 19
Decimals:   31
Flags:      NOT_NULL

+---------------------+
| @@version           |
+---------------------+
| 5.1.22-rc-community |
+---------------------+
1 row in set (0.00 sec)
[27 Feb 2009 13:40] 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/commits/67856

2828 Sergey Glukhov	2009-02-27
      Bug#41030 Wrong meta data (incorrect fieldlen)
      set user variable max length on
      fix_length_and_dec() stage
      using real value length.
     @ mysql-test/r/variables.result
        test result
     @ mysql-test/t/variables.test
        test case
     @ sql/item_func.cc
        set user variable max length
        on fix_length_and_dec()
        using real value length.
[27 Feb 2009 14:24] Georgi Kodinov
Regression from bug #32124
[5 Mar 2009 11:34] 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/commits/68362

2832 Sergey Glukhov	2009-03-05
      Bug#41030 Wrong meta data (incorrect fieldlen)
      set user variable max length on
      fix_length_and_dec() stage
      using real value length.
     @ mysql-test/r/variables.result
        test result
     @ mysql-test/t/variables.test
        test case
     @ sql/item_func.cc
        set user variable max length on
        fix_length_and_dec() stage
        using real value length.
[13 Mar 2009 19:05] Bugs System
Pushed into 5.1.33 (revid:joro@sun.com-20090313111355-7bsi1hgkvrg8pdds) (version source revid:zhou.li@sun.com-20090311061050-ihp0g77znonq1tuq) (merge vers: 5.1.33) (pib:6)
[18 Mar 2009 13:21] Bugs System
Pushed into 6.0.11-alpha (revid:joro@sun.com-20090318122208-1b5kvg6zeb4hxwp9) (version source revid:matthias.leich@sun.com-20090310140952-gwtoq87wykhji3zi) (merge vers: 6.0.11-alpha) (pib:6)
[19 Mar 2009 3:36] Paul DuBois
Noted in 5.1.33, 6.0.11 changelog.

For user-defined variables in a query result, incorrect length values
were returned in the result metadata.
[9 May 2009 16:43] Bugs System
Pushed into 5.1.34-ndb-6.2.18 (revid:jonas@mysql.com-20090508185236-p9b3as7qyauybefl) (version source revid:jonas@mysql.com-20090508100057-30ote4xggi4nq14v) (merge vers: 5.1.33-ndb-6.2.18) (pib:6)
[9 May 2009 17:40] Bugs System
Pushed into 5.1.34-ndb-6.3.25 (revid:jonas@mysql.com-20090509063138-1u3q3v09wnn2txyt) (version source revid:jonas@mysql.com-20090508175813-s6yele2z3oh6o99z) (merge vers: 5.1.33-ndb-6.3.25) (pib:6)
[9 May 2009 18:38] Bugs System
Pushed into 5.1.34-ndb-7.0.6 (revid:jonas@mysql.com-20090509154927-im9a7g846c6u1hzc) (version source revid:jonas@mysql.com-20090509073226-09bljakh9eppogec) (merge vers: 5.1.33-ndb-7.0.6) (pib:6)