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

Make "show collations" data not-nullable

    XMLWordPrintable

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

            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.