summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorbar@mysql.com <>2005-07-13 13:00:17 +0500
committerbar@mysql.com <>2005-07-13 13:00:17 +0500
commit5150fdcc04efca4e2dd7bb435bc0e3438cc2f5be (patch)
tree9041e1c0fb031c01d3baa28560c8df50c1a532e1 /sql/sql_table.cc
parentff764e2b5aa687deb50285303e12e49be0ee3d9c (diff)
downloadmariadb-git-5150fdcc04efca4e2dd7bb435bc0e3438cc2f5be.tar.gz
ctype_utf8.result:
adding test case sql_table.cc: sql_table.cc: - do not create a new item when charsets are the same - return ER_INVALID_DEFAULT if default value cannot be converted into the column character set. item.cc: - Allow conversion not only to Unicode, but also to and from "binary". - Adding safe_charset_converter() for Item_num and Item_varbinary, returning a fixed const Item.
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index b68b20c32a3..e27cd7196ed 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -557,10 +557,15 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
Convert the default value from client character
set into the column character set if necessary.
*/
- if (sql_field->def)
+ if (sql_field->def && cs != sql_field->def->collation.collation)
{
- sql_field->def=
- sql_field->def->safe_charset_converter(cs);
+ if (!(sql_field->def=
+ sql_field->def->safe_charset_converter(cs)))
+ {
+ /* Could not convert */
+ my_error(ER_INVALID_DEFAULT, MYF(0), sql_field->field_name);
+ DBUG_RETURN(-1);
+ }
}
if (sql_field->sql_type == FIELD_TYPE_SET)