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

Truncation without warning

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 10.10.2
    • None
    • Variables
    • None

    Description

      When trying to represent the binary string of a user variable the output is 0, but no warning was returned.

      How to repeat:

      MariaDB [test]> set @a:=b'101';
      Query OK, 0 rows affected (0,001 sec)
       
      MariaDB [test]> select hex(@a);
      +---------+
      | hex(@a) |
      +---------+
      | 05      |
      +---------+
      1 row in set (0,001 sec)
       
      MariaDB [test]> select bin(hex(@a));
      +--------------+
      | bin(hex(@a)) |
      +--------------+
      | 101          |
      +--------------+
      1 row in set (0,001 sec)
       
      # No warning returned
      MariaDB [test]> select bin(@a);
      +---------+
      | bin(@a) |
      +---------+
      | 0       |
      +---------+
      1 row in set (0,001 sec)
      

      Works as expected with MySQL :

      MySQL [(none)]> set @a:=b'101';
      Query OK, 0 rows affected (0,001 sec)
       
      MySQL [(none)]> select bin(@a);
      +---------+
      | bin(@a) |
      +---------+
      | 0       |
      +---------+
      1 row in set, 1 warning (0,001 sec)
       
      MySQL [(none)]> show warnings;
      +---------+------+-------------------------------------------+
      | Level   | Code | Message                                   |
      +---------+------+-------------------------------------------+
      | Warning | 1292 | Truncated incorrect DECIMAL value: '\x05' |
      +---------+------+-------------------------------------------+
      1 row in set (0,001 sec)
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            georg Georg Richter
            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.