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

Unexpected behavior in string manipulation functions.

    XMLWordPrintable

Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Major
    • Resolution: Unresolved
    • 11.4.2, 10.5, 10.6, 10.11, 11.2(EOL), 11.4
    • 10.5, 10.6, 10.11, 11.4
    • None
    • None
    • ubuntu 20.04

    Description

      drop table if exists t6;
      create table t6 (c22 int);
      insert into t6 values (16);
      insert into t6 values (80);
       
      select HEX(t6.c22) >REVERSE(RPAD(case when true then '+YeL' else '+YeL' end, t6.c22, '7+02o'))  as c1 from t6;
       
       
      +------+
      | c1   |
      +------+
      |    1 |
      |    0 |
      +------+
      2 rows in set (0.00 sec)
       
       
      select * from t6
      where HEX(t6.c22) > REVERSE(RPAD(case when true then '+YeL' else '+YeL' end, t6.c22, '7+02o'));
      +------+
      | c22  |
      +------+
      |   16 |
      |   80 |
      +------+
      2 rows in set (0.00 sec)
       
      
      

      The result of the first SELECT SQL is the content of the WHERE clause in the second SELECT SQL, and the results returned are 1 and 0. Therefore, the query result of the second statement should only have one row. There seems to be some kind of bug.

       
      drop table if exists t6;
      create table t6 (c22 int);
      -- insert into t6 values (16);
      insert into t6 values (80);
       
      select HEX(t6.c22) >REVERSE(RPAD(case when true then '+YeL' else '+YeL' end, t6.c22, '7+02o'))  as c1 from t6;
      +------+
      | c1   |
      +------+
      |    0 |
      +------+
      1 row in set (0.00 sec)
       
       
      select * from t6
      where HEX(t6.c22) > REVERSE(RPAD(case when true then '+YeL' else '+YeL' end, t6.c22, '7+02o'));
      Empty set (0.00 sec)
       
      
      

      Additionally, I tried deleting the inserted value 16, and the query results of these two statements became normal.This is strange.

      Attachments

        Issue Links

          Activity

            People

              psergei Sergei Petrunia
              Wangdada HeShan
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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