1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

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.


mysql-test/r/strict.result:
  fix (Bugs #8295 and #8296: varchar and varbinary conversion)
mysql-test/r/type_blob.result:
  fix (Bugs #8295 and #8296: varchar and varbinary conversion)
mysql-test/t/strict.test:
  fix (Bugs #8295 and #8296: varchar and varbinary conversion)
sql/sql_table.cc:
  fix (Bugs #8295 and #8296: varchar and varbinary conversion):
  1. fon't convert datatypes if it's strict mode;
  2. better warning.
This commit is contained in:
unknown
2005-05-12 15:56:04 +05:00
parent c572e46980
commit 362a340de3
4 changed files with 19 additions and 3 deletions

View File

@ -1345,7 +1345,8 @@ static bool prepare_blob_field(THD *thd, create_field *sql_field)
/* 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 @@ static bool prepare_blob_field(THD *thd, create_field *sql_field)
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);