diff options
author | evgen@moonbone.local <> | 2006-07-16 00:45:38 +0400 |
---|---|---|
committer | evgen@moonbone.local <> | 2006-07-16 00:45:38 +0400 |
commit | f1346cf8f6f8d6f557168572c59de7cf58b4ef4f (patch) | |
tree | e461b7d2c3a29dd54448d57d1c11a56487facb0d /sql/item.cc | |
parent | 10b2590c0b8a0d766f1b15330f3d9681aa41f9aa (diff) | |
download | mariadb-git-f1346cf8f6f8d6f557168572c59de7cf58b4ef4f.tar.gz |
Fixed bug#10977: No warning issued if a column name is truncated
When an alias is set to a column leading spaces are removed from the alias.
But when this is done on aliases set by user this can lead to confusion.
Now Item::set_name() method issues the warning if leading spaces were removed
from an alias set by user.
New warning message is added.
Diffstat (limited to 'sql/item.cc')
-rw-r--r-- | sql/item.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sql/item.cc b/sql/item.cc index 511ea1ffb44..ad8b79182d4 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -573,6 +573,7 @@ void Item::set_name(const char *str, uint length, CHARSET_INFO *cs) } if (cs->ctype) { + uint orig_len= length; /* This will probably need a better implementation in the future: a function in CHARSET_INFO structure. @@ -582,6 +583,11 @@ void Item::set_name(const char *str, uint length, CHARSET_INFO *cs) length--; str++; } + if (orig_len != length && !is_autogenerated_name) + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_REMOVED_SPACES, ER(ER_REMOVED_SPACES), + str + length - orig_len); + } if (!my_charset_same(cs, system_charset_info)) { |