Bug #9535 Warning for "create table t as select uuid();"
Submitted: 31 Mar 2005 17:30 Modified: 7 Dec 2005 18:48
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.4-beta-debug/4.1 BK OS:Linux (SUSE 9.2)
Assigned to: Magnus Blåudd CPU Architecture:Any

[31 Mar 2005 17:30] Peter Gulutzan
Description:
As we expect from the documentation, length(uuid()) > 12. But when I say
"create table t as select uuid();", MySQL creates a varchar(12) column.
That's too small for the formatted uuid() string, so I get a warning.

How to repeat:
mysql> create table t as select uuid();
Query OK, 1 row affected, 1 warning (0.01 sec)
Records: 1  Duplicates: 0  Warnings: 1

mysql> show warnings;
+---------+------+---------------------------------------------+
| Level   | Code | Message                                     |
+---------+------+---------------------------------------------+
| Warning | 1265 | Data truncated for column 'uuid()' at row 1 |
+---------+------+---------------------------------------------+
1 row in set (0.00 sec)

mysql> show create table t;
+-------+-------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table|
+-------+-------------------------------------------------------------------------------------------------------------------------+
| t     | CREATE TABLE `t` (
  `uuid()` varchar(12) character set utf8 NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
+-------+-------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.01 sec)
[10 May 2005 14:00] Magnus Blåudd
Looks like the Item_func_str descendants should set their maxlength to maxlength*collation.collation->mbmaxlen. 

Have to get some expert help.
[10 May 2005 15:41] 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/24785
[17 May 2005 18:32] 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/24984
[19 May 2005 11:20] Magnus Blåudd
Pushed to 5.0.6 and 4.1.13
[19 May 2005 14:37] Paul DuBois
Noted in 4.1.13, 5.0.6 changelogs.
[17 Sep 2005 13:02] MySQL Verification Team
Version 4.1.XX was not fixed as reported by bug:

http://bugs.mysql.com/bug.php?id=13290

miguel@hegel:~/dbs/4.1> bin/mysqladmin -uroot create db8
miguel@hegel:~/dbs/4.1> bin/mysql -uroot db8
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 4.1.15-debug-log

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

mysql> create table ui as select uuid();
Query OK, 1 row affected, 1 warning (0.04 sec)
Records: 1  Duplicates: 0  Warnings: 1

mysql> show warnings;
+---------+------+---------------------------------------------+
| Level   | Code | Message                                     |
+---------+------+---------------------------------------------+
| Warning | 1265 | Data truncated for column 'uuid()' at row 1 |
+---------+------+---------------------------------------------+
1 row in set (0.00 sec)
[7 Dec 2005 14:45] 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/33141
[7 Dec 2005 18:48] Magnus Blåudd
Pushed to 4.1.17