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

@@default_master_connection does not convert character sets

    XMLWordPrintable

Details

    • Unexpected results
    • Q3/2026 Replic. Maintenance, Q3/2026 Replic. Development

    Description

      GBK encoding

      SET NAMES GBK;
       
      SET       @@SESSION.default_master_connection= 'Latin';
      SELECT    @@SESSION.default_master_connection , #=> Latin
        CHARSET(@@SESSION.default_master_connection); #=> utf8mb3
       
      SET       @@SESSION.default_master_connection= '汉字';
      SELECT    @@SESSION.default_master_connection , #=> ????
        CHARSET(@@SESSION.default_master_connection); #=> utf8mb3
       
      SET       @@GLOBAL.init_slave= '汉字'; # not bugged
      SELECT    @@GLOBAL.init_slave , #=> 汉字
        CHARSET(@@GLOBAL.init_slave); #=> utf8mb3
      SET @@GLOBAL.init_slave= DEFAULT;
       
      SET       @mystr= '汉字'; # not affected
      SELECT    @mystr , #=> 汉字
        CHARSET(@mystr); #=> gbk
      

      Analysis

      Item::val_str() doesn't specify the collation of the returned string.
      For example, Item_string::val_str() returns the string behind this item, thus using the collation of the item.

      However, Sys_var_session_lexstring::do_check() does not realize this detail and expects the string to be in the @@character_set_system collation.

      Sys_var_session_lexstring has been merged away in 11.3 (Commit 6151bde48c); its only instance was @@default_master_connection.


      [P.S.]
      @@debug_sync has the same mistake and has not been merged away.
      @@debug_dbug is not bugged.

      Attachments

        Issue Links

          Activity

            People

              Elkin Andrei Elkin
              ParadoxV5 Jimmy Hú
              Jimmy Hú Jimmy Hú
              Andrei Elkin Andrei Elkin
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - 0.5d
                  0.5d
                  Remaining:
                  Time Spent - 2h 35m Remaining Estimate - 1h
                  1h
                  Logged:
                  Time Spent - 2h 35m Remaining Estimate - 1h Time Not Required
                  2h 35m

                  Git Integration

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