Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-32816

Make "show collations" data not-nullable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Duplicate
    • None
    • N/A
    • Protocol
    • None

    Description

      MariaDb returns some nulls as collation info.
      That crashes the .Net MySql driver and Oracle os not willing to fix their driver.

      On connect, the driver tries to load collations IDs and cast them to
      integers.
      However collation is nullable and there are some null-collations, for
      example:

      +--------------------------------+----------+------+---------+----------+---------+
      | Collation                      | Charset  | Id   | Default | Compiled
      | Sortlen |
      +--------------------------------+----------+------+---------+----------+---------+
       
      | uca1400_ai_ci                  | NULL     | NULL | NULL    | Yes     
      |       8 |
      | uca1400_ai_cs                  | NULL     | NULL | NULL    | Yes     
      |       8 |
      | uca1400_as_ci                  | NULL     | NULL | NULL    | Yes     
      |       8 |
      | uca1400_as_cs                  | NULL     | NULL | NULL    | Yes     
      |       8 |
      

      So the driver fails to connect the database:
      InvalidCast_FromDBNull: Object cannot be cast from DBNull to other
      types.

      Driver has the following code:

                      MySqlCommand mySqlCommand = new MySqlCommand("SHOW COLLATION",
      connection);
                      try
                      {
                              using MySqlDataReader mySqlDataReader =
      mySqlCommand.ExecuteReader();
                              CharacterSets = new Dictionary<int, string>();
                              while (mySqlDataReader.Read())
                              {
                                      CharacterSets[Convert.ToInt32(mySqlDataReader["id"],
      NumberFormatInfo.InvariantInfo)] =
      mySqlDataReader.GetString(mySqlDataReader.GetOrdinal("charset"));
                              }
                      }
                      catch (Exception ex)
                      {
                              MySqlTrace.LogError(ThreadID, ex.Message);
                              throw;
                      }
      


      See e.g.: https://bugs.mysql.com/bug.php?id=109331

      Attachments

        Issue Links

          Activity

            danblack Daniel Black added a comment -

            Is there a reason the https://github.com/mysql-net/MySqlConnector and MariaDB Connector/J are unacceptable solutions?

            danblack Daniel Black added a comment - Is there a reason the https://github.com/mysql-net/MySqlConnector and MariaDB Connector/J are unacceptable solutions?
            wlad Vladislav Vaintroub added a comment - - edited

            danblack, I do not think we can force anyone to MySqlConnector no matter how good it is, the Oracle's connector remains slightly more popular.
            It is not a drop-in, and people may depend on other open source or closed source software, which happened to use Oracle's connector
            Also, as we promised client compatibity, I think we should try to keep this promise

            I tried to collect some links on the internet for this issue , it is in MDEV-31608 . We broke OnlyOffice, PowerBI, Toad, and some other stuff with NULL collation ids (something that nobody uses, and something that could be put into a dedicated table).

            wlad Vladislav Vaintroub added a comment - - edited danblack , I do not think we can force anyone to MySqlConnector no matter how good it is, the Oracle's connector remains slightly more popular. It is not a drop-in, and people may depend on other open source or closed source software, which happened to use Oracle's connector Also, as we promised client compatibity, I think we should try to keep this promise I tried to collect some links on the internet for this issue , it is in MDEV-31608 . We broke OnlyOffice, PowerBI, Toad, and some other stuff with NULL collation ids (something that nobody uses, and something that could be put into a dedicated table).

            People

              Unassigned Unassigned
              thorium Tuomas Hietanen
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.