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 | ec5e43da337688d4b6f169143bb9e12409402f3b (patch) | |
tree | 662b953a9b7a988908cf18b0f3d8d52bc2d30bbb /sql/sql_partition.cc | |
parent | ad74ed74d9e285a3678b98235094c16eafcbff3a (diff) | |
parent | c574a9c414f817975f75a08744b2f0bea1232ff3 (diff) | |
download | mariadb-git-ec5e43da337688d4b6f169143bb9e12409402f3b.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) { |