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

equality operation on cast of the value "-0.0" to decimal not working

    XMLWordPrintable

    Details

      Description

      This is slightly obscure but i recently encountered it, so

      > create table test (a varchar(255));
      Query OK, 0 rows affected (0.02 sec)
       
      > insert into test values ('-0.0');
      Query OK, 1 row affected (0.00 sec)
       
      > select * from test where cast(a as decimal(5,1)) < 0;
      +------+
      | a    |
      +------+
      | -0.0 |
      +------+
      1 row in set (0.00 sec)
      > select * from test where cast(a as decimal(5,1)) > 0;
      Empty set (0.00 sec)
      > select @@version;
      +-----------------+
      | @@version       |
      +-----------------+
      | 10.1.14-MariaDB |
      +-----------------+
      1 row in set (0.00 sec)
      

        Attachments

          Activity

            People

            Assignee:
            serg Sergei Golubchik
            Reporter:
            scottmf Scott Feldstein
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Git Integration