Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Not a Bug
    • None
    • N/A
    • Character Sets
    • None

    Description

      Noticed from testing of MDEV-34911 by lstartseva

      If we do (https://jira.mariadb.org/browse/MDEV-34911?focusedCommentId=295449&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-295449)

      explain format=json select * from t where c like 'b\\%_c%'
      

      we get

      query 'explain format=json select * from t where  c like 'b\\%_c%'' failed: ER_CANT_AGGREGATE_2COLLATIONS (1267): Illegal mix of collations (swe7_swedish_ci,IMPLICIT) and (latin1_swedish_ci,COERCIBLE) for operation 'like'
      

      This is caused by a conversion failure caused by a call to my_wc_mb_8bit with a backslash character, see the MDEV-34911 comment linked above, and comments surrounding that comment.

      As observed by psergei:

      MariaDB [test]> set names latin1;
      Query OK, 0 rows affected (0.000 sec)
       
      MariaDB [test]> select convert('\\' using swe7);
      +--------------------------+
      | convert('\\' using swe7) |
      +--------------------------+
      | ?                        |
      +--------------------------+
      1 row in set, 1 warning (0.001 sec)
       
      MariaDB [test]> show warnings;
      +---------+------+--------------------------------------------------+
      | Level   | Code | Message                                          |
      +---------+------+--------------------------------------------------+
      | Warning | 1977 | Cannot convert 'latin1' character 0x5C to 'swe7' |
      +---------+------+--------------------------------------------------+
      1 row in set (0.000 sec)
      

      Attachments

        Issue Links

          Activity

            The code point of the ASCII backslash \ is reserved for the character Ö in this 7-bit character set. The lower-case ö is |. Is this really a bug?

            marko Marko Mäkelä added a comment - The code point of the ASCII backslash \ is reserved for the character Ö in this 7-bit character set. The lower-case ö is |. Is this really a bug?

            I realize that if the intention is to pass a literal % to the query string (instead of letting it to be treated as a wild card), this can be considered a bug. Typically, the national 7-bit variants of ASCII only replaced some code points between 0x5b and 0x5f as well as between 0x7b and 0x7f. Coincidentally, the underscore (0x5f) might have been replaced with É. If that is the case, searching for a literal underscore instead of letting it to be treated as a LIKE wildcard might rightly fail.

            marko Marko Mäkelä added a comment - I realize that if the intention is to pass a literal % to the query string (instead of letting it to be treated as a wild card), this can be considered a bug. Typically, the national 7-bit variants of ASCII only replaced some code points between 0x5b and 0x5f as well as between 0x7b and 0x7f. Coincidentally, the underscore (0x5f) might have been replaced with É. If that is the case, searching for a literal underscore instead of letting it to be treated as a LIKE wildcard might rightly fail.
            psergei Sergei Petrunia added a comment - - edited

            Closing as not a bug.

            For MDEV-34911, we could use some other character as escape character, but it's not worth the effort. If there is anybody still using swe7, they certainly can do without new optimizations.

            psergei Sergei Petrunia added a comment - - edited Closing as not a bug. For MDEV-34911 , we could use some other character as escape character, but it's not worth the effort. If there is anybody still using swe7, they certainly can do without new optimizations.

            People

              bar Alexander Barkov
              ycp Yuchen Pei
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.