From: Date: May 12 2005 12:56pm Subject: bk commit into 5.0 tree (ramil:1.1940) BUG#8295 List-Archive: http://lists.mysql.com/internals/24811 X-Bug: 8295 Message-Id: <200505121056.j4CAuC36083754@gw.mysql.r18.ru> Below is the list of changes that have just been committed into a local 5.0 repository of ram. When ram does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet 1.1940 05/05/12 15:56:04 ramil@stripped +4 -0 fix (Bug #8295 and #8296: varchar and varbinary conversion) select, gis & gis-tree tests fails at the moment, but I will push this CS because it was tested before and I'm absolutely sure it's right. sql/sql_table.cc 1.243 05/05/12 15:55:10 ramil@stripped +3 -2 fix (Bugs #8295 and #8296: varchar and varbinary conversion): 1. fon't convert datatypes if it's strict mode; 2. better warning. mysql-test/t/strict.test 1.12 05/05/12 15:55:09 ramil@stripped +10 -0 fix (Bugs #8295 and #8296: varchar and varbinary conversion) mysql-test/r/type_blob.result 1.46 05/05/12 15:55:09 ramil@stripped +1 -1 fix (Bugs #8295 and #8296: varchar and varbinary conversion) mysql-test/r/strict.result 1.17 05/05/12 15:55:09 ramil@stripped +5 -0 fix (Bugs #8295 and #8296: varchar and varbinary conversion) # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: ramil # Host: gw.mysql.r18.ru # Root: /usr/home/ram/work/mysql-5.0 --- 1.242/sql/sql_table.cc 2005-05-07 17:21:46 +05:00 +++ 1.243/sql/sql_table.cc 2005-05-12 15:55:10 +05:00 @@ -1345,7 +1345,8 @@ /* Convert long VARCHAR columns to TEXT or BLOB */ char warn_buff[MYSQL_ERRMSG_SIZE]; - if (sql_field->def) + if (sql_field->def || (thd->variables.sql_mode & (MODE_STRICT_TRANS_TABLES | + MODE_STRICT_ALL_TABLES))) { my_error(ER_TOO_BIG_FIELDLENGTH, MYF(0), sql_field->field_name, MAX_FIELD_VARCHARLENGTH / sql_field->charset->mbmaxlen); @@ -1354,7 +1355,7 @@ sql_field->sql_type= FIELD_TYPE_BLOB; sql_field->flags|= BLOB_FLAG; sprintf(warn_buff, ER(ER_AUTO_CONVERT), sql_field->field_name, - "VARCHAR", + (sql_field->charset == &my_charset_bin) ? "VARBINARY" : "VARCHAR", (sql_field->charset == &my_charset_bin) ? "BLOB" : "TEXT"); push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_AUTO_CONVERT, warn_buff); --- 1.45/mysql-test/r/type_blob.result 2005-04-06 07:45:08 +05:00 +++ 1.46/mysql-test/r/type_blob.result 2005-05-12 15:55:09 +05:00 @@ -9,7 +9,7 @@ e longtext YES NULL CREATE TABLE t2 (a char(255), b varbinary(70000), c varchar(70000000)); Warnings: -Note 1246 Converting column 'b' from VARCHAR to BLOB +Note 1246 Converting column 'b' from VARBINARY to BLOB Note 1246 Converting column 'c' from VARCHAR to TEXT CREATE TABLE t4 (c varchar(65530) character set utf8 not null); Warnings: --- 1.16/mysql-test/r/strict.result 2005-04-06 08:55:04 +05:00 +++ 1.17/mysql-test/r/strict.result 2005-05-12 15:55:09 +05:00 @@ -1232,3 +1232,8 @@ Warnings: Warning 1364 Field 'i' doesn't have a default value DROP TABLE t1; +set @@sql_mode='traditional'; +create table t1(a varchar(65537)); +ERROR 42000: Column length too big for column 'a' (max = 65535); use BLOB or TEXT instead +create table t1(a varbinary(65537)); +ERROR 42000: Column length too big for column 'a' (max = 65535); use BLOB or TEXT instead --- 1.11/mysql-test/t/strict.test 2005-04-06 07:45:34 +05:00 +++ 1.12/mysql-test/t/strict.test 2005-05-12 15:55:09 +05:00 @@ -1083,3 +1083,13 @@ INSERT INTO t1 SET j = 1, i = DEFAULT(i); INSERT INTO t1 VALUES (DEFAULT,1); DROP TABLE t1; + +# +# Bugs #8295 and #8296: varchar and varbinary conversion +# + +set @@sql_mode='traditional'; +--error 1074 +create table t1(a varchar(65537)); +--error 1074 +create table t1(a varbinary(65537));