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

Unexpected row returned for >= comparison between TINYTEXT and JSON object text

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Critical
    • Resolution: Unresolved
    • 12.2.2
    • None
    • Server
    • None
    • Docker: mariadb:12.2.2
      Server version: 12.2.2-MariaDB-ubu2404
      Source revision: d26a6f44c1f2119377e79a9540886c6d8c01472f

    Description

      Hi, I found a logic bug in MariaDB 12.2.2.

      A query that should have returned an empty set actually returned 1.

      I executed this query in DBMSs such as TiDB, and the result returned was an empty set.

      Expected results:

      Empty set
      

      Actual Results:

      +---+
      | 1 |
      +---+
      | 1 |
      +---+
      1 row in set (0.00 sec)
      

      How to repeat:

      -- create table
      DROP TABLE IF EXISTS `t0`;
      DROP TABLE IF EXISTS `t1`;
      CREATE TABLE t0 (c0 DECIMAL(10,0) UNSIGNED NOT NULL, c1 TINYTEXT);
      INSERT INTO t0 VALUES (1, '0.7387026232049367');
      CREATE TABLE t1 ( c0 DECIMAL(10,0) UNSIGNED);
      INSERT INTO t1 VALUES(0);
       
      -- query, expect:Empty set, actual:{1}
      SELECT
          1
      FROM `t1` AS ref_0
      INNER JOIN `t0` AS ref_1
          ON TRUE
      WHERE ref_1.c1 >= JSON_UNQUOTE(
          JSON_EXTRACT(
              JSON_OBJECT(
                  'k',
                  JSON_SET(
                      JSON_OBJECT('k', ref_0.c0),
                      '$.k',
                      ref_0.c0
                  )
              ),
              '$.k'
          )
      )
      ORDER BY c1 ASC;
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            Yuxiao Guo Yuxiao Guo
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.