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

Incorrect result may caused by type transformation(different result with MySQL)

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 11.4.1, 10.9(EOL)
    • None
    • Data types
    • None
    • Ubuntu 22.04

    Description

      Description

      Sql1 and sql2 should return the same result if condition f1 in sql2 is true. Otherwise,sql2 should return nothing.

      However,sql1 and sql2 return different value.

      SQL1:

      SELECT f1 FROM (SELECT (t1.c0 - (-1^1)) AS f1 FROM t1) AS t;
      
      

      SQL2:

      SELECT f1 FROM (SELECT (t1.c0 - (-1^1)) AS f1 FROM t1) AS t WHERE f1; 
      

      How to repeat

      CREATE TABLE t1(c0 VARCHAR(100));
      INSERT INTO t1 VALUES ('1');
      

      version

       
      SELECT version();
       
      +---------------------------------------+
      | version()                             |
      +---------------------------------------+
      | 11.4.1-MariaDB-1:11.4.1+maria~ubu2204 |
      +---------------------------------------+
      1 row in set (0.00 sec)
      

      SELECT f1 FROM (SELECT (t1.c0 - (-1^1)) AS f1 FROM t1) AS t;--sql1
       
      +------------------------+
      | f1                     |
      +------------------------+
      | -1.8446744073709552e19 |
      +------------------------+
      1 row in set (0.00 sec)
      

      SELECT f1 FROM (SELECT (t1.c0 - (-1^1)) AS f1 FROM t1) AS t WHERE f1; --sql2
       
      +------+
      | f1   |
      +------+
      |    3 |
      +------+
      1 row in set (0.00 sec)
      

      I execute two sqls in MySQL 8.0+ , both of them return -18446744073709552000

      Attachments

        Activity

          People

            Unassigned Unassigned
            Syang ysy
            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.