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

Minus string is converted to -0

    XMLWordPrintable

Details

    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

        Activity

          People

            Unassigned Unassigned
            f_razzoli Federico Razzoli
            Votes:
            1 Vote for this issue
            Watchers:
            4 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.