dbms: fixed error messages in alter

This commit is contained in:
Pavel Kartavyy 2013-12-23 09:29:27 +00:00
parent 097405ff6f
commit 60f69f8be0
2 changed files with 5 additions and 5 deletions

View File

@ -78,7 +78,7 @@ void InterpreterAlterQuery::execute()
/// Проверяем, что колонка еще не существует
if (std::find_if(columns_copy.begin(), columns_copy.end(), boost::bind(namesEqual, name_type.name, _1)) != columns_copy.end())
throw Exception("Wrong column name. Column already exists", DB::ErrorCodes::ILLEGAL_COLUMN);
throw Exception("Wrong column name. Column " << name_type.name << " already exists", DB::ErrorCodes::ILLEGAL_COLUMN);
/// Проверяем опциональный аргумент AFTER
ASTs::iterator insert_it = columns_copy.end();
@ -87,7 +87,7 @@ void InterpreterAlterQuery::execute()
const ASTIdentifier & col_after = dynamic_cast<const ASTIdentifier &>(*params.column);
insert_it = std::find_if(columns_copy.begin(), columns_copy.end(), boost::bind(namesEqualIgnoreAfterDot, col_after.name, _1)) ;
if (insert_it == columns_copy.end())
throw Exception("Wrong column name. Cannot find column to insert after", DB::ErrorCodes::ILLEGAL_COLUMN);
throw Exception("Wrong column name. Cannot find column " << col_after.name << " to insert after", DB::ErrorCodes::ILLEGAL_COLUMN);
}
columns_copy.insert(insert_it, params.name_type);
}
@ -101,7 +101,7 @@ void InterpreterAlterQuery::execute()
ASTs::iterator drop_it = std::find_if(columns_copy.begin(), columns_copy.end(), boost::bind(namesEqual, drop_column.name, _1));
if (drop_it == columns_copy.end())
throw Exception("Wrong column name. Cannot find column to drop", DB::ErrorCodes::ILLEGAL_COLUMN);
throw Exception("Wrong column name. Cannot find column " << drop_column.name <<" to drop", DB::ErrorCodes::ILLEGAL_COLUMN);
else
columns_copy.erase(drop_it);
}

View File

@ -165,7 +165,7 @@ void IStorage::alterColumns(const ASTAlterQuery::Parameters & params, NamesAndTy
NamesAndTypesList::reverse_iterator reverse_insert_it = std::find_if(columns->rbegin(), columns->rend(), boost::bind(namesEqual, column_name, _1) );
if (reverse_insert_it == columns->rend())
throw Exception("Wrong column name. Cannot find column to insert after", DB::ErrorCodes::ILLEGAL_COLUMN);
throw Exception("Wrong column name. Cannot find column " << column_name << " to insert after", DB::ErrorCodes::ILLEGAL_COLUMN);
else
{
/// base возвращает итератор уже смещенный на один элемент вправо
@ -199,7 +199,7 @@ void IStorage::alterColumns(const ASTAlterQuery::Parameters & params, NamesAndTy
if (column_it == columns->end())
{
if (is_first)
throw Exception("Wrong column name. Cannot find column to drop", DB::ErrorCodes::ILLEGAL_COLUMN);
throw Exception("Wrong column name. Cannot find column " << column_name << " to drop", DB::ErrorCodes::ILLEGAL_COLUMN);
}
else
columns->erase(column_it);