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

Wrong result for field_bigint=0x000000000000000000001

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 5.5, 10.0, 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9
    • 10.3
    • OTHER
    • None

    Description

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a BIGINT UNSIGNED);
      INSERT INTO t1 VALUES (0x000000000000000000001);
      SHOW WARNINGS;
      SELECT * FROM t1;

      returns:

      +---------+------+--------------------------------------------+
      | Level   | Code | Message                                    |
      +---------+------+--------------------------------------------+
      | Warning | 1264 | Out of range value for column 'a' at row 1 |
      +---------+------+--------------------------------------------+
      +----------------------+
      | a                    |
      +----------------------+
      | 18446744073709551615 |
      +----------------------+

      Storing 1 without a warning would be a more expected behavior.

      Moreover, CAST returns 1, without warnings:

      +-------------------------------------------+
      | CAST(0x000000000000000000001 AS UNSIGNED) |
      +-------------------------------------------+
      |                                         1 |
      +-------------------------------------------+

      CAST looks better than a field assignment.

      Attachments

        Activity

          People

            bar Alexander Barkov
            bar Alexander Barkov
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.