diff options
author | Mattias Jonsson <mattias.jonsson@oracle.com> | 2011-01-26 16:50:21 +0100 |
---|---|---|
committer | Mattias Jonsson <mattias.jonsson@oracle.com> | 2011-01-26 16:50:21 +0100 |
commit | 4e47db3af4fa17862e1212167896e5723f12f297 (patch) | |
tree | 662b953a9b7a988908cf18b0f3d8d52bc2d30bbb /sql/sql_partition.cc | |
parent | 15f635fdf611ab5eefa7641d65dbdfaa1d3eaadb (diff) | |
parent | 9ecf3156794ea83ddf35dc19acce7f2288505567 (diff) | |
download | mariadb-git-4e47db3af4fa17862e1212167896e5723f12f297.tar.gz |
merge
Diffstat (limited to 'sql/sql_partition.cc')
-rw-r--r-- | sql/sql_partition.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index f8e5130880b..cb55695d4c1 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -761,6 +761,9 @@ static bool handle_list_of_fields(List_iterator<char> it, bool result; char *field_name; bool is_list_empty= TRUE; + int fields_handled = 0; + char* field_name_array[MAX_KEY]; + DBUG_ENTER("handle_list_of_fields"); while ((field_name= it++)) @@ -776,6 +779,25 @@ static bool handle_list_of_fields(List_iterator<char> it, result= TRUE; goto end; } + + /* + Check for duplicate fields in the list. + Assuming that there are not many fields in the partition key list. + If there were, it would be better to replace the for-loop + with a more efficient algorithm. + */ + + field_name_array[fields_handled] = field_name; + for (int i = 0; i < fields_handled; ++i) + { + if (my_strcasecmp(system_charset_info, + field_name_array[i], field_name) == 0) + { + my_error(ER_FIELD_NOT_FOUND_PART_ERROR, MYF(0)); + DBUG_RETURN(TRUE); + } + } + fields_handled++; } if (is_list_empty) { |