Hi Serg,

>> A test was added, that uses MySql.Data from powershell - only works
>> if MySql.Data is installed into GAC (i.e with C/NET MSI package)
>
>please, make sure that MySql.Data is installed on at least one buildbot
>builder.

It is on 3 buildbot builders now .There is 8.0.31 version of the connector on "old" buildbot", and latest 8.2.0 on new "buildbot", the required builder. The added test is succeeding everywhere.

>wouldn't it be better to do instead
>
>-        bool is_context= cmp(context_collation_name, full_collation_name);
>+        bool is_context= cmp(context_collation_name, full_collation_name)
>+                     && !(thd->variables.old_behavior & OLD_MODE_NO_NULL_COLLATION_IDS);
>
>?

Right, seems better to me too. If this connector is so much interested in collation id => charset mappings, it does not hurt to have full picture (in practice it mostly likely will be only seeing utf8mb4 variations only, but better safe than sorry)
I changed it like you proposed.

Best,
Wlad

From: Sergei Golubchik <serg@mariadb.org>
Sent: Wednesday, November 29, 2023 8:45 PM
To: Vladislav Vaintroub <vvaintroub@gmail.com>
Cc: developers@lists.mariadb.org <developers@lists.mariadb.org>
Subject: Re: d25ab9fdfa1: MDEV-31608 - Connector/NET fails to connect since 10.10
 
Hi, Vladislav,

On Nov 29, Vladislav Vaintroub wrote:
> revision-id: d25ab9fdfa1 (mariadb-10.11.2-62-gd25ab9fdfa1)
> parent(s): 034848c6c27
> author: Vladislav Vaintroub
> committer: Vladislav Vaintroub
> timestamp: 2023-10-08 19:37:20 +0200
> message:
>
> MDEV-31608 - Connector/NET fails to connect since 10.10
>
> Connector/NET does not expect collation IDs returned by "show collations"
> to be NULL, runs into an exception.
>
> The fix is to determine connector/net using its connection attributes,
> exclude null-id collations from "show collations".The patch introduces
> new old_mode NO_NULL_COLLATION_IDs, that is automatically set,
> once MySQL Connector/NET connection is determined.

I don't like this hack at all, but I don't have any better ideas,
so just one question below

> A test was added, that uses MySql.Data from powershell - only works
> if MySql.Data is installed into GAC (i.e with C/NET MSI package)

please, make sure that MySql.Data is installed on at least one buildbot
builder.

> diff --git a/sql/sql_show.cc b/sql/sql_show.cc
> index bff55f7a431..bea993305be 100644
> --- a/sql/sql_show.cc
> +++ b/sql/sql_show.cc
> @@ -6386,7 +6386,8 @@ int fill_schema_collation(THD *thd, TABLE_LIST *tables, COND *cond)
>            character set prefix).
>          */
>          if (is_context &&
> -            cmp(tmp_cl->cs_name, Lex_cstring(STRING_WITH_LEN("utf8mb4"))))
> +            ((thd->variables.old_behavior & OLD_MODE_NO_NULL_COLLATION_IDS) ||
> +            cmp(tmp_cl->cs_name, Lex_cstring(STRING_WITH_LEN("utf8mb4")))))

wouldn't it be better to do instead

-        bool is_context= cmp(context_collation_name, full_collation_name);
+        bool is_context= cmp(context_collation_name, full_collation_name)
+                     && !(thd->variables.old_behavior & OLD_MODE_NO_NULL_COLLATION_IDS);

?

>            continue;
>        restore_record(table, s->default_values);
>          table->field[0]->store(context_collation_name, scs);

Regards,
Sergei
Chief Architect, MariaDB Server
and security@mariadb.org