Hello, Sergei, Here's a new patch version: https://github.com/MariaDB/server/commit/d2de9a89d801cbced9701479e564644340a... Please see comments below. On 12/13/23 19:16, Sergei Golubchik wrote: <cut>
diff --git a/sql/lex_ident.h b/sql/lex_ident.h index f39273b7da5..db96e40cab8 100644 --- a/sql/lex_ident.h +++ b/sql/lex_ident.h + if (dbls.length > SAFE_NAME_LEN) + { + sql_print_warning(ER_THD(thd, ER_WRONG_DB_NAME), dbls.str);
It's an error log, should every message be localized according to connection-specific locale?
Done. Fixed to ER_DEFAULT(ER_WRONG_DB_NAME).
And removed thd as a function argument, I hope
Forgot to remove thd. Now removed. Thank.
diff --git a/storage/perfschema/pfs_program.cc b/storage/perfschema/pfs_program.cc index de456610519..6c35a745d30 100644 --- a/storage/perfschema/pfs_program.cc +++ b/storage/perfschema/pfs_program.cc @@ -118,31 +118,20 @@ static void set_program_key(PFS_program_key *key, */
char *ptr= &key->m_hash_key[0]; + const char *end= ptr + sizeof(key->m_hash_key) - 1;
ptr[0]= object_type; ptr++;
if (object_name_length > 0) - { - char tmp_object_name[COL_OBJECT_NAME_SIZE + 1]; - memcpy(tmp_object_name, object_name, object_name_length); - tmp_object_name[object_name_length]= '\0'; - my_casedn_str(system_charset_info, tmp_object_name); - memcpy(ptr, tmp_object_name, object_name_length); - ptr+= object_name_length; - } + ptr+= system_charset_info->casedn(object_name, object_name_length, + ptr, end - ptr); ptr[0]= 0; ptr++;
if (schema_name_length > 0) - { - char tmp_schema_name[COL_OBJECT_SCHEMA_SIZE + 1]; - memcpy(tmp_schema_name, schema_name, schema_name_length); - tmp_schema_name[schema_name_length]='\0'; - my_casedn_str(system_charset_info, tmp_schema_name); - memcpy(ptr, tmp_schema_name, schema_name_length); - ptr+= schema_name_length; - } + ptr+= system_charset_info->casedn(schema_name, schema_name_length, + ptr, end - ptr);
That's strange. casedn of schema when lower_case_table_names==0 ?
I'm not strong with this part of the code. So here I just tried to preserve the behavior before the change. Can you suggest an SQL script which would likely to return a wrong result because of of this code?
something like this:
create database FOO; create database foo; create procedure FOO.sp () select 1; create procedure foo.sp () select 2; call FOO.sp(); call foo.sp(); select object_type, object_schema, object_name, count_star, count_statements, sum_rows_sent from performance_schema.events_statements_summary_by_program where object_type='procedure'; drop database FOO; drop database foo;
Thanks. This script helped. There is a bug indeed. There are even two bugs :) I reported them as: - MDEV-33020 The database part is not case sensitive in SP names in PERFORMANCE_SCHEMA (for the problem that you noticed during the review) - MDEV-33019 The database part is not case sensitive in SP names (for another problem that I found) My last patch includes a fix for MDEV-33020, for PERFORMANCE_SCHEMA, as the patch changes the related lines anyway. It does not include a fix fir MDEV-33019 though, as the problem here is in Sp_cache, which is not touched by the current task. I suggest we fix both MDEV-33020 and MDEV-33019 should be fixed starting from 10.4. Thanks.
Regards, Sergei Chief Architect, MariaDB Server and security@mariadb.org