Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 10.0.10
    • Fix Version/s: 10.0.13
    • Component/s: None
    • Labels:
      None

      Description

      Found while merging type_bit test. type_bit patch attached.

      CREATE TABLE t1(f1 bit(2) NOT NULL default b'10',f2 bit(14) NOT NULL default b'11110000111100');
      INSERT INTO t1 (f1) VALUES (DEFAULT);
      INSERT INTO t1 VALUES (b'',b''),('','');
      SELECT HEX(f1), HEX(f2) FROM t1;
      HEX(f1)	HEX(f2)
      2	3C3C
      2	3C8F <!-------- should be 0 0?
      0	0
      DROP TABLE t1;
      

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              igor Igor Babaev added a comment - - edited

              Here' s what we have for MyISAM (the correct result):

              MariaDB [test]> CREATE TABLE t1(f1 bit(2)) ENGINE=MYISAM;
              Query OK, 0 rows affected (0.01 sec)
              
              MariaDB [test]> INSERT INTO t1 VALUES (b'');
              Query OK, 1 row affected (0.00 sec)
              
              MariaDB [test]> SELECT HEX(f1) from t1;
              +---------+
              | HEX(f1) |
              +---------+
              | 0       |
              +---------+
              1 row in set (0.00 sec)
              
              MariaDB [test]> SELECT bin(f1) from t1;
              +---------+
              | bin(f1) |
              +---------+
              | 0       |
              +---------+
              1 row in set (0.00 sec)
              

              And here's what we have for INNODB (an incorrect result):

              MariaDB [test]> CREATE TABLE t2(f1 bit(2)) ENGINE=INNODB;
              Query OK, 0 rows affected (0.06 sec)
              
              MariaDB [test]> INSERT INTO t2 VALUES (b'');
              Query OK, 1 row affected (0.01 sec)
              
              MariaDB [test]> SELECT HEX(f1) from t2;
              +---------+
              | HEX(f1) |
              +---------+
              | 8F      |
              +---------+
              1 row in set (0.00 sec)
              
              MariaDB [test]> SELECT bin(f1) from t2;
              +----------+
              | bin(f1)  |
              +----------+
              | 10001111 |
              +----------+
              1 row in set (0.00 sec)
              

              mysql-5.6 returns the correct result in both cases.

              Show
              igor Igor Babaev added a comment - - edited Here' s what we have for MyISAM (the correct result): MariaDB [test]> CREATE TABLE t1(f1 bit(2)) ENGINE=MYISAM; Query OK, 0 rows affected (0.01 sec) MariaDB [test]> INSERT INTO t1 VALUES (b''); Query OK, 1 row affected (0.00 sec) MariaDB [test]> SELECT HEX(f1) from t1; +---------+ | HEX(f1) | +---------+ | 0 | +---------+ 1 row in set (0.00 sec) MariaDB [test]> SELECT bin(f1) from t1; +---------+ | bin(f1) | +---------+ | 0 | +---------+ 1 row in set (0.00 sec) And here's what we have for INNODB (an incorrect result): MariaDB [test]> CREATE TABLE t2(f1 bit(2)) ENGINE=INNODB; Query OK, 0 rows affected (0.06 sec) MariaDB [test]> INSERT INTO t2 VALUES (b''); Query OK, 1 row affected (0.01 sec) MariaDB [test]> SELECT HEX(f1) from t2; +---------+ | HEX(f1) | +---------+ | 8F | +---------+ 1 row in set (0.00 sec) MariaDB [test]> SELECT bin(f1) from t2; +----------+ | bin(f1) | +----------+ | 10001111 | +----------+ 1 row in set (0.00 sec) mysql-5.6 returns the correct result in both cases.

                People

                • Assignee:
                  serg Sergei Golubchik
                  Reporter:
                  svoj Sergey Vojtovich
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Time Tracking

                    Estimated:
                    Original Estimate - Not Specified
                    Not Specified
                    Remaining:
                    Remaining Estimate - 0 minutes
                    0m
                    Logged:
                    Time Spent - 1 hour, 30 minutes
                    1h 30m