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.


mysql-test/t/select.test:
  Added test case for bug#10977:No warning issued if a column name is truncated.
mysql-test/r/select.result:
  Added test case for bug#10977:No warning issued if a column name is truncated.
sql/sql_yacc.yy:
  Fixed bug#10977: No warning issued if a column name is truncated
  The is_autogenerated_name flag is set before set_name() method call.
sql/item.cc:
  Fixed bug#10977: No warning issued if a column name is truncated
  Now Item::set_name() method issues the warning if leading spaces were removed
  from an alias set by user.
This commit is contained in:
unknown 2006-07-16 00:45:38 +04:00
commit 1c96f2d73e
4 changed files with 18 additions and 2 deletions

View file

@ -4060,8 +4060,8 @@ select_item:
YYABORT;
if ($4.str)
{
$2->set_name($4.str, $4.length, system_charset_info);
$2->is_autogenerated_name= FALSE;
$2->set_name($4.str, $4.length, system_charset_info);
}
else if (!$2->name) {
char *str = $1;
@ -4936,8 +4936,8 @@ udf_expr:
{
if ($4.str)
{
$2->set_name($4.str, $4.length, system_charset_info);
$2->is_autogenerated_name= FALSE;
$2->set_name($4.str, $4.length, system_charset_info);
}
else
$2->set_name($1, (uint) ($3 - $1), YYTHD->charset());