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

Minus string is converted to -0

    XMLWordPrintable

Details

    • Unexpected results
    • Change the "-0" results in many SELECT scenarios to just return "0".

    Description

      MariaDB [test]> SELECT @x := -'', @y := 0 - '';
      +-----------+--------------+
      | @x := -'' | @y := 0 - '' |
      +-----------+--------------+
      |        -0 |            0 |
      +-----------+--------------+
      1 row in set, 2 warnings (0.001 sec)
       
      Warning (Code 1292): Truncated incorrect DOUBLE value: ''
      Warning (Code 1292): Truncated incorrect DOUBLE value: ''
       
      MariaDB [test]> SELECT -0, -0.0, -(DATE '0000-00-00'), @x, -@x, --@x;
      +----+------+----------------------+------+------+------+
      | -0 | -0.0 | -(DATE '0000-00-00') | @x   | -@x  | --@x |
      +----+------+----------------------+------+------+------+
      |  0 |  0.0 |                    0 |   -0 |    0 |   -0 |
      +----+------+----------------------+------+------+------+
      1 row in set (0.000 sec)
      

      I don't think that -0 is an intended result, and it seems to only occur in one specific case.

      I'm reporting this bug mainly to document that this anomaly exists. Just in case it has consequences in some corner cases.

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              f_razzoli Federico Razzoli
              Alexander Barkov Alexander Barkov
              Votes:
              1 Vote for this issue
              Watchers:
              6 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.