Commit 6d3186e3 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-23323 Rounding functions return a wrong data type for a BIT, ENUM, SET argument

Implementing dedicated fixing methods:
- Type_handler_bit::Item_func_round_fix_length_and_dec()
- Type_handler_bit::Item_func_int_val_fix_length_and_dec()
- Type_handler_typelib::Item_func_round_fix_length_and_dec()

because the inherited methods did not work well.

Fixing:
- Type_handler_typelib::Item_func_int_val_fix_length_and_dec
  It did not work well, because it used args[0]->max_length to
  calculate the result data type. In case of ENUM and SET it was
  not correct, because in FLOOR() and CEILING() context
  ENUM and SET return not more than 5 digits (65535 is the biggest
  possible value).

Misc:
- Changing the API of
    Type_handler_bit::Bit_decimal_notation_int_digits(const Item *item)
  to a more generic form:
    Type_handler_bit::Bit_decimal_notation_int_digits_by_nbits(uint nbits)

- Fixing Type_handler_bit::Bit_decimal_notation_int_digits_by_nbits() to
  return the exact number of decimal digits for all nbits 1..64.
  The old implementation was approximate.
  This change gives better (more precise) data types.
parent 92499ae9
...@@ -2619,7 +2619,7 @@ HEX(c1) ...@@ -2619,7 +2619,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(3) DEFAULT NULL `c1` varchar(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(4)); CREATE OR REPLACE TABLE t1 (c1 BIT(4));
...@@ -2664,7 +2664,7 @@ HEX(c1) ...@@ -2664,7 +2664,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(5) DEFAULT NULL `c1` varchar(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(7)); CREATE OR REPLACE TABLE t1 (c1 BIT(7));
...@@ -2709,7 +2709,7 @@ HEX(c1) ...@@ -2709,7 +2709,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(6) DEFAULT NULL `c1` varchar(5) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(10)); CREATE OR REPLACE TABLE t1 (c1 BIT(10));
...@@ -2754,7 +2754,7 @@ HEX(c1) ...@@ -2754,7 +2754,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(7) DEFAULT NULL `c1` varchar(6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(13)); CREATE OR REPLACE TABLE t1 (c1 BIT(13));
...@@ -2769,7 +2769,7 @@ HEX(c1) ...@@ -2769,7 +2769,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(7) DEFAULT NULL `c1` varchar(6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(14)); CREATE OR REPLACE TABLE t1 (c1 BIT(14));
...@@ -2799,7 +2799,7 @@ HEX(c1) ...@@ -2799,7 +2799,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(9) DEFAULT NULL `c1` varchar(7) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(16)); CREATE OR REPLACE TABLE t1 (c1 BIT(16));
...@@ -2814,7 +2814,7 @@ HEX(c1) ...@@ -2814,7 +2814,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(9) DEFAULT NULL `c1` varchar(7) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(17)); CREATE OR REPLACE TABLE t1 (c1 BIT(17));
...@@ -2844,7 +2844,7 @@ HEX(c1) ...@@ -2844,7 +2844,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(10) DEFAULT NULL `c1` varchar(9) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(19)); CREATE OR REPLACE TABLE t1 (c1 BIT(19));
...@@ -2859,7 +2859,7 @@ HEX(c1) ...@@ -2859,7 +2859,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(10) DEFAULT NULL `c1` varchar(9) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(20)); CREATE OR REPLACE TABLE t1 (c1 BIT(20));
...@@ -2889,7 +2889,7 @@ HEX(c1) ...@@ -2889,7 +2889,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(11) DEFAULT NULL `c1` varchar(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(22)); CREATE OR REPLACE TABLE t1 (c1 BIT(22));
...@@ -2904,7 +2904,7 @@ HEX(c1) ...@@ -2904,7 +2904,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(11) DEFAULT NULL `c1` varchar(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(23)); CREATE OR REPLACE TABLE t1 (c1 BIT(23));
...@@ -2919,7 +2919,7 @@ HEX(c1) ...@@ -2919,7 +2919,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(11) DEFAULT NULL `c1` varchar(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(24)); CREATE OR REPLACE TABLE t1 (c1 BIT(24));
...@@ -2934,7 +2934,7 @@ HEX(c1) ...@@ -2934,7 +2934,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(13) DEFAULT NULL `c1` varchar(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(25)); CREATE OR REPLACE TABLE t1 (c1 BIT(25));
...@@ -2949,7 +2949,7 @@ HEX(c1) ...@@ -2949,7 +2949,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(13) DEFAULT NULL `c1` varchar(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(26)); CREATE OR REPLACE TABLE t1 (c1 BIT(26));
...@@ -2964,7 +2964,7 @@ HEX(c1) ...@@ -2964,7 +2964,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(13) DEFAULT NULL `c1` varchar(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(27)); CREATE OR REPLACE TABLE t1 (c1 BIT(27));
...@@ -2979,7 +2979,7 @@ HEX(c1) ...@@ -2979,7 +2979,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(14) DEFAULT NULL `c1` varchar(13) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(28)); CREATE OR REPLACE TABLE t1 (c1 BIT(28));
...@@ -2994,7 +2994,7 @@ HEX(c1) ...@@ -2994,7 +2994,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(14) DEFAULT NULL `c1` varchar(13) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(29)); CREATE OR REPLACE TABLE t1 (c1 BIT(29));
...@@ -3009,7 +3009,7 @@ HEX(c1) ...@@ -3009,7 +3009,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(14) DEFAULT NULL `c1` varchar(13) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(30)); CREATE OR REPLACE TABLE t1 (c1 BIT(30));
...@@ -3024,7 +3024,7 @@ HEX(c1) ...@@ -3024,7 +3024,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(15) DEFAULT NULL `c1` varchar(14) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(31)); CREATE OR REPLACE TABLE t1 (c1 BIT(31));
...@@ -3039,7 +3039,7 @@ HEX(c1) ...@@ -3039,7 +3039,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(15) DEFAULT NULL `c1` varchar(14) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(32)); CREATE OR REPLACE TABLE t1 (c1 BIT(32));
...@@ -3054,7 +3054,7 @@ HEX(c1) ...@@ -3054,7 +3054,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(15) DEFAULT NULL `c1` varchar(14) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(33)); CREATE OR REPLACE TABLE t1 (c1 BIT(33));
...@@ -3069,7 +3069,7 @@ HEX(c1) ...@@ -3069,7 +3069,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(17) DEFAULT NULL `c1` varchar(14) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(34)); CREATE OR REPLACE TABLE t1 (c1 BIT(34));
...@@ -3084,7 +3084,7 @@ HEX(c1) ...@@ -3084,7 +3084,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(17) DEFAULT NULL `c1` varchar(15) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(35)); CREATE OR REPLACE TABLE t1 (c1 BIT(35));
...@@ -3099,7 +3099,7 @@ HEX(c1) ...@@ -3099,7 +3099,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(17) DEFAULT NULL `c1` varchar(15) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(36)); CREATE OR REPLACE TABLE t1 (c1 BIT(36));
...@@ -3114,7 +3114,7 @@ HEX(c1) ...@@ -3114,7 +3114,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(18) DEFAULT NULL `c1` varchar(15) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(37)); CREATE OR REPLACE TABLE t1 (c1 BIT(37));
...@@ -3129,7 +3129,7 @@ HEX(c1) ...@@ -3129,7 +3129,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(18) DEFAULT NULL `c1` varchar(17) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(38)); CREATE OR REPLACE TABLE t1 (c1 BIT(38));
...@@ -3144,7 +3144,7 @@ HEX(c1) ...@@ -3144,7 +3144,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(18) DEFAULT NULL `c1` varchar(17) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(39)); CREATE OR REPLACE TABLE t1 (c1 BIT(39));
...@@ -3159,7 +3159,7 @@ HEX(c1) ...@@ -3159,7 +3159,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(19) DEFAULT NULL `c1` varchar(17) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(40)); CREATE OR REPLACE TABLE t1 (c1 BIT(40));
...@@ -3174,7 +3174,7 @@ HEX(c1) ...@@ -3174,7 +3174,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(19) DEFAULT NULL `c1` varchar(18) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(41)); CREATE OR REPLACE TABLE t1 (c1 BIT(41));
...@@ -3189,7 +3189,7 @@ HEX(c1) ...@@ -3189,7 +3189,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(19) DEFAULT NULL `c1` varchar(18) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(42)); CREATE OR REPLACE TABLE t1 (c1 BIT(42));
...@@ -3204,7 +3204,7 @@ HEX(c1) ...@@ -3204,7 +3204,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(21) DEFAULT NULL `c1` varchar(18) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(43)); CREATE OR REPLACE TABLE t1 (c1 BIT(43));
...@@ -3219,7 +3219,7 @@ HEX(c1) ...@@ -3219,7 +3219,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(21) DEFAULT NULL `c1` varchar(18) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(44)); CREATE OR REPLACE TABLE t1 (c1 BIT(44));
...@@ -3234,7 +3234,7 @@ HEX(c1) ...@@ -3234,7 +3234,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(21) DEFAULT NULL `c1` varchar(19) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(45)); CREATE OR REPLACE TABLE t1 (c1 BIT(45));
...@@ -3249,7 +3249,7 @@ HEX(c1) ...@@ -3249,7 +3249,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(22) DEFAULT NULL `c1` varchar(19) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(46)); CREATE OR REPLACE TABLE t1 (c1 BIT(46));
...@@ -3264,7 +3264,7 @@ HEX(c1) ...@@ -3264,7 +3264,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(22) DEFAULT NULL `c1` varchar(19) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(47)); CREATE OR REPLACE TABLE t1 (c1 BIT(47));
...@@ -3279,7 +3279,7 @@ HEX(c1) ...@@ -3279,7 +3279,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(22) DEFAULT NULL `c1` varchar(21) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(48)); CREATE OR REPLACE TABLE t1 (c1 BIT(48));
...@@ -3294,7 +3294,7 @@ HEX(c1) ...@@ -3294,7 +3294,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(23) DEFAULT NULL `c1` varchar(21) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(49)); CREATE OR REPLACE TABLE t1 (c1 BIT(49));
...@@ -3309,7 +3309,7 @@ HEX(c1) ...@@ -3309,7 +3309,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(23) DEFAULT NULL `c1` varchar(21) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(50)); CREATE OR REPLACE TABLE t1 (c1 BIT(50));
...@@ -3324,7 +3324,7 @@ HEX(c1) ...@@ -3324,7 +3324,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(23) DEFAULT NULL `c1` varchar(22) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(51)); CREATE OR REPLACE TABLE t1 (c1 BIT(51));
...@@ -3339,7 +3339,7 @@ HEX(c1) ...@@ -3339,7 +3339,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(25) DEFAULT NULL `c1` varchar(22) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(52)); CREATE OR REPLACE TABLE t1 (c1 BIT(52));
...@@ -3354,7 +3354,7 @@ HEX(c1) ...@@ -3354,7 +3354,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(25) DEFAULT NULL `c1` varchar(22) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(53)); CREATE OR REPLACE TABLE t1 (c1 BIT(53));
...@@ -3369,7 +3369,7 @@ HEX(c1) ...@@ -3369,7 +3369,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(25) DEFAULT NULL `c1` varchar(22) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(54)); CREATE OR REPLACE TABLE t1 (c1 BIT(54));
...@@ -3384,7 +3384,7 @@ HEX(c1) ...@@ -3384,7 +3384,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(26) DEFAULT NULL `c1` varchar(23) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(55)); CREATE OR REPLACE TABLE t1 (c1 BIT(55));
...@@ -3399,7 +3399,7 @@ HEX(c1) ...@@ -3399,7 +3399,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(26) DEFAULT NULL `c1` varchar(23) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(56)); CREATE OR REPLACE TABLE t1 (c1 BIT(56));
...@@ -3414,7 +3414,7 @@ HEX(c1) ...@@ -3414,7 +3414,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(26) DEFAULT NULL `c1` varchar(23) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(57)); CREATE OR REPLACE TABLE t1 (c1 BIT(57));
...@@ -3429,7 +3429,7 @@ HEX(c1) ...@@ -3429,7 +3429,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(27) DEFAULT NULL `c1` varchar(25) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(58)); CREATE OR REPLACE TABLE t1 (c1 BIT(58));
...@@ -3444,7 +3444,7 @@ HEX(c1) ...@@ -3444,7 +3444,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(27) DEFAULT NULL `c1` varchar(25) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(59)); CREATE OR REPLACE TABLE t1 (c1 BIT(59));
...@@ -3459,7 +3459,7 @@ HEX(c1) ...@@ -3459,7 +3459,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(27) DEFAULT NULL `c1` varchar(25) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(60)); CREATE OR REPLACE TABLE t1 (c1 BIT(60));
...@@ -3474,7 +3474,7 @@ HEX(c1) ...@@ -3474,7 +3474,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(29) DEFAULT NULL `c1` varchar(26) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(61)); CREATE OR REPLACE TABLE t1 (c1 BIT(61));
...@@ -3489,7 +3489,7 @@ HEX(c1) ...@@ -3489,7 +3489,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(29) DEFAULT NULL `c1` varchar(26) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(62)); CREATE OR REPLACE TABLE t1 (c1 BIT(62));
...@@ -3504,7 +3504,7 @@ HEX(c1) ...@@ -3504,7 +3504,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(29) DEFAULT NULL `c1` varchar(26) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(63)); CREATE OR REPLACE TABLE t1 (c1 BIT(63));
...@@ -3519,7 +3519,7 @@ HEX(c1) ...@@ -3519,7 +3519,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(30) DEFAULT NULL `c1` varchar(26) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (c1 BIT(64)); CREATE OR REPLACE TABLE t1 (c1 BIT(64));
...@@ -3534,7 +3534,7 @@ HEX(c1) ...@@ -3534,7 +3534,7 @@ HEX(c1)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c1` varchar(30) DEFAULT NULL `c1` varchar(27) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE OR REPLACE TABLE t1 (f float); CREATE OR REPLACE TABLE t1 (f float);
......
...@@ -876,5 +876,988 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -876,5 +876,988 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
DROP TABLE t1; DROP TABLE t1;
# #
# MDEV-23323 Rounding functions return a wrong data type for a BIT, ENUM, SET argument
#
BEGIN NOT ATOMIC
FOR i IN 1..64
DO
SELECT '-----', CONCAT('BIT(',i,')') AS Type;
EXECUTE IMMEDIATE REPLACE('CREATE TABLE t1 (a BIT(64))','64', i);
INSERT IGNORE INTO t1 VALUES (0xFFFFFFFFFFFFFFFF);
CREATE TABLE t2 AS SELECT
a,
FLOOR(a) AS cf,
CEILING(a) AS cc,
ROUND(a) AS cr,
TRUNCATE(a,0) AS ct
FROM t1;
SHOW CREATE TABLE t2;
SELECT CAST(a AS UNSIGNED) AS a, cf, cc, cr, ct FROM t2;
DROP TABLE t2;
DROP TABLE t1;
END FOR;
END;
$$
----- -----
Type BIT(1)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(1) DEFAULT NULL,
`cf` int(1) unsigned DEFAULT NULL,
`cc` int(1) unsigned DEFAULT NULL,
`cr` int(1) unsigned DEFAULT NULL,
`ct` int(1) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 1
cf 1
cc 1
cr 1
ct 1
----- -----
Type BIT(2)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(2) DEFAULT NULL,
`cf` int(1) unsigned DEFAULT NULL,
`cc` int(1) unsigned DEFAULT NULL,
`cr` int(1) unsigned DEFAULT NULL,
`ct` int(1) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 3
cf 3
cc 3
cr 3
ct 3
----- -----
Type BIT(3)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(3) DEFAULT NULL,
`cf` int(1) unsigned DEFAULT NULL,
`cc` int(1) unsigned DEFAULT NULL,
`cr` int(1) unsigned DEFAULT NULL,
`ct` int(1) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 7
cf 7
cc 7
cr 7
ct 7
----- -----
Type BIT(4)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(4) DEFAULT NULL,
`cf` int(2) unsigned DEFAULT NULL,
`cc` int(2) unsigned DEFAULT NULL,
`cr` int(2) unsigned DEFAULT NULL,
`ct` int(2) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 15
cf 15
cc 15
cr 15
ct 15
----- -----
Type BIT(5)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(5) DEFAULT NULL,
`cf` int(2) unsigned DEFAULT NULL,
`cc` int(2) unsigned DEFAULT NULL,
`cr` int(2) unsigned DEFAULT NULL,
`ct` int(2) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 31
cf 31
cc 31
cr 31
ct 31
----- -----
Type BIT(6)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(6) DEFAULT NULL,
`cf` int(2) unsigned DEFAULT NULL,
`cc` int(2) unsigned DEFAULT NULL,
`cr` int(2) unsigned DEFAULT NULL,
`ct` int(2) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 63
cf 63
cc 63
cr 63
ct 63
----- -----
Type BIT(7)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(7) DEFAULT NULL,
`cf` int(3) unsigned DEFAULT NULL,
`cc` int(3) unsigned DEFAULT NULL,
`cr` int(3) unsigned DEFAULT NULL,
`ct` int(3) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 127
cf 127
cc 127
cr 127
ct 127
----- -----
Type BIT(8)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(8) DEFAULT NULL,
`cf` int(3) unsigned DEFAULT NULL,
`cc` int(3) unsigned DEFAULT NULL,
`cr` int(3) unsigned DEFAULT NULL,
`ct` int(3) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 255
cf 255
cc 255
cr 255
ct 255
----- -----
Type BIT(9)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(9) DEFAULT NULL,
`cf` int(3) unsigned DEFAULT NULL,
`cc` int(3) unsigned DEFAULT NULL,
`cr` int(3) unsigned DEFAULT NULL,
`ct` int(3) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 511
cf 511
cc 511
cr 511
ct 511
----- -----
Type BIT(10)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(10) DEFAULT NULL,
`cf` int(4) unsigned DEFAULT NULL,
`cc` int(4) unsigned DEFAULT NULL,
`cr` int(4) unsigned DEFAULT NULL,
`ct` int(4) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 1023
cf 1023
cc 1023
cr 1023
ct 1023
----- -----
Type BIT(11)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(11) DEFAULT NULL,
`cf` int(4) unsigned DEFAULT NULL,
`cc` int(4) unsigned DEFAULT NULL,
`cr` int(4) unsigned DEFAULT NULL,
`ct` int(4) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 2047
cf 2047
cc 2047
cr 2047
ct 2047
----- -----
Type BIT(12)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(12) DEFAULT NULL,
`cf` int(4) unsigned DEFAULT NULL,
`cc` int(4) unsigned DEFAULT NULL,
`cr` int(4) unsigned DEFAULT NULL,
`ct` int(4) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 4095
cf 4095
cc 4095
cr 4095
ct 4095
----- -----
Type BIT(13)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(13) DEFAULT NULL,
`cf` int(4) unsigned DEFAULT NULL,
`cc` int(4) unsigned DEFAULT NULL,
`cr` int(4) unsigned DEFAULT NULL,
`ct` int(4) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 8191
cf 8191
cc 8191
cr 8191
ct 8191
----- -----
Type BIT(14)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(14) DEFAULT NULL,
`cf` int(5) unsigned DEFAULT NULL,
`cc` int(5) unsigned DEFAULT NULL,
`cr` int(5) unsigned DEFAULT NULL,
`ct` int(5) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 16383
cf 16383
cc 16383
cr 16383
ct 16383
----- -----
Type BIT(15)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(15) DEFAULT NULL,
`cf` int(5) unsigned DEFAULT NULL,
`cc` int(5) unsigned DEFAULT NULL,
`cr` int(5) unsigned DEFAULT NULL,
`ct` int(5) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 32767
cf 32767
cc 32767
cr 32767
ct 32767
----- -----
Type BIT(16)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(16) DEFAULT NULL,
`cf` int(5) unsigned DEFAULT NULL,
`cc` int(5) unsigned DEFAULT NULL,
`cr` int(5) unsigned DEFAULT NULL,
`ct` int(5) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 65535
cf 65535
cc 65535
cr 65535
ct 65535
----- -----
Type BIT(17)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(17) DEFAULT NULL,
`cf` int(6) unsigned DEFAULT NULL,
`cc` int(6) unsigned DEFAULT NULL,
`cr` int(6) unsigned DEFAULT NULL,
`ct` int(6) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 131071
cf 131071
cc 131071
cr 131071
ct 131071
----- -----
Type BIT(18)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(18) DEFAULT NULL,
`cf` int(6) unsigned DEFAULT NULL,
`cc` int(6) unsigned DEFAULT NULL,
`cr` int(6) unsigned DEFAULT NULL,
`ct` int(6) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 262143
cf 262143
cc 262143
cr 262143
ct 262143
----- -----
Type BIT(19)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(19) DEFAULT NULL,
`cf` int(6) unsigned DEFAULT NULL,
`cc` int(6) unsigned DEFAULT NULL,
`cr` int(6) unsigned DEFAULT NULL,
`ct` int(6) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 524287
cf 524287
cc 524287
cr 524287
ct 524287
----- -----
Type BIT(20)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(20) DEFAULT NULL,
`cf` int(7) unsigned DEFAULT NULL,
`cc` int(7) unsigned DEFAULT NULL,
`cr` int(7) unsigned DEFAULT NULL,
`ct` int(7) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 1048575
cf 1048575
cc 1048575
cr 1048575
ct 1048575
----- -----
Type BIT(21)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(21) DEFAULT NULL,
`cf` int(7) unsigned DEFAULT NULL,
`cc` int(7) unsigned DEFAULT NULL,
`cr` int(7) unsigned DEFAULT NULL,
`ct` int(7) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 2097151
cf 2097151
cc 2097151
cr 2097151
ct 2097151
----- -----
Type BIT(22)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(22) DEFAULT NULL,
`cf` int(7) unsigned DEFAULT NULL,
`cc` int(7) unsigned DEFAULT NULL,
`cr` int(7) unsigned DEFAULT NULL,
`ct` int(7) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 4194303
cf 4194303
cc 4194303
cr 4194303
ct 4194303
----- -----
Type BIT(23)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(23) DEFAULT NULL,
`cf` int(7) unsigned DEFAULT NULL,
`cc` int(7) unsigned DEFAULT NULL,
`cr` int(7) unsigned DEFAULT NULL,
`ct` int(7) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 8388607
cf 8388607
cc 8388607
cr 8388607
ct 8388607
----- -----
Type BIT(24)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(24) DEFAULT NULL,
`cf` int(8) unsigned DEFAULT NULL,
`cc` int(8) unsigned DEFAULT NULL,
`cr` int(8) unsigned DEFAULT NULL,
`ct` int(8) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 16777215
cf 16777215
cc 16777215
cr 16777215
ct 16777215
----- -----
Type BIT(25)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(25) DEFAULT NULL,
`cf` int(8) unsigned DEFAULT NULL,
`cc` int(8) unsigned DEFAULT NULL,
`cr` int(8) unsigned DEFAULT NULL,
`ct` int(8) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 33554431
cf 33554431
cc 33554431
cr 33554431
ct 33554431
----- -----
Type BIT(26)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(26) DEFAULT NULL,
`cf` int(8) unsigned DEFAULT NULL,
`cc` int(8) unsigned DEFAULT NULL,
`cr` int(8) unsigned DEFAULT NULL,
`ct` int(8) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 67108863
cf 67108863
cc 67108863
cr 67108863
ct 67108863
----- -----
Type BIT(27)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(27) DEFAULT NULL,
`cf` int(9) unsigned DEFAULT NULL,
`cc` int(9) unsigned DEFAULT NULL,
`cr` int(9) unsigned DEFAULT NULL,
`ct` int(9) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 134217727
cf 134217727
cc 134217727
cr 134217727
ct 134217727
----- -----
Type BIT(28)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(28) DEFAULT NULL,
`cf` int(9) unsigned DEFAULT NULL,
`cc` int(9) unsigned DEFAULT NULL,
`cr` int(9) unsigned DEFAULT NULL,
`ct` int(9) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 268435455
cf 268435455
cc 268435455
cr 268435455
ct 268435455
----- -----
Type BIT(29)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(29) DEFAULT NULL,
`cf` int(9) unsigned DEFAULT NULL,
`cc` int(9) unsigned DEFAULT NULL,
`cr` int(9) unsigned DEFAULT NULL,
`ct` int(9) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 536870911
cf 536870911
cc 536870911
cr 536870911
ct 536870911
----- -----
Type BIT(30)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(30) DEFAULT NULL,
`cf` int(10) unsigned DEFAULT NULL,
`cc` int(10) unsigned DEFAULT NULL,
`cr` int(10) unsigned DEFAULT NULL,
`ct` int(10) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 1073741823
cf 1073741823
cc 1073741823
cr 1073741823
ct 1073741823
----- -----
Type BIT(31)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(31) DEFAULT NULL,
`cf` int(10) unsigned DEFAULT NULL,
`cc` int(10) unsigned DEFAULT NULL,
`cr` int(10) unsigned DEFAULT NULL,
`ct` int(10) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 2147483647
cf 2147483647
cc 2147483647
cr 2147483647
ct 2147483647
----- -----
Type BIT(32)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(32) DEFAULT NULL,
`cf` int(10) unsigned DEFAULT NULL,
`cc` int(10) unsigned DEFAULT NULL,
`cr` int(10) unsigned DEFAULT NULL,
`ct` int(10) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 4294967295
cf 4294967295
cc 4294967295
cr 4294967295
ct 4294967295
----- -----
Type BIT(33)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(33) DEFAULT NULL,
`cf` bigint(10) unsigned DEFAULT NULL,
`cc` bigint(10) unsigned DEFAULT NULL,
`cr` bigint(10) unsigned DEFAULT NULL,
`ct` bigint(10) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 8589934591
cf 8589934591
cc 8589934591
cr 8589934591
ct 8589934591
----- -----
Type BIT(34)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(34) DEFAULT NULL,
`cf` bigint(11) unsigned DEFAULT NULL,
`cc` bigint(11) unsigned DEFAULT NULL,
`cr` bigint(11) unsigned DEFAULT NULL,
`ct` bigint(11) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 17179869183
cf 17179869183
cc 17179869183
cr 17179869183
ct 17179869183
----- -----
Type BIT(35)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(35) DEFAULT NULL,
`cf` bigint(11) unsigned DEFAULT NULL,
`cc` bigint(11) unsigned DEFAULT NULL,
`cr` bigint(11) unsigned DEFAULT NULL,
`ct` bigint(11) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 34359738367
cf 34359738367
cc 34359738367
cr 34359738367
ct 34359738367
----- -----
Type BIT(36)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(36) DEFAULT NULL,
`cf` bigint(11) unsigned DEFAULT NULL,
`cc` bigint(11) unsigned DEFAULT NULL,
`cr` bigint(11) unsigned DEFAULT NULL,
`ct` bigint(11) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 68719476735
cf 68719476735
cc 68719476735
cr 68719476735
ct 68719476735
----- -----
Type BIT(37)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(37) DEFAULT NULL,
`cf` bigint(12) unsigned DEFAULT NULL,
`cc` bigint(12) unsigned DEFAULT NULL,
`cr` bigint(12) unsigned DEFAULT NULL,
`ct` bigint(12) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 137438953471
cf 137438953471
cc 137438953471
cr 137438953471
ct 137438953471
----- -----
Type BIT(38)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(38) DEFAULT NULL,
`cf` bigint(12) unsigned DEFAULT NULL,
`cc` bigint(12) unsigned DEFAULT NULL,
`cr` bigint(12) unsigned DEFAULT NULL,
`ct` bigint(12) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 274877906943
cf 274877906943
cc 274877906943
cr 274877906943
ct 274877906943
----- -----
Type BIT(39)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(39) DEFAULT NULL,
`cf` bigint(12) unsigned DEFAULT NULL,
`cc` bigint(12) unsigned DEFAULT NULL,
`cr` bigint(12) unsigned DEFAULT NULL,
`ct` bigint(12) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 549755813887
cf 549755813887
cc 549755813887
cr 549755813887
ct 549755813887
----- -----
Type BIT(40)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(40) DEFAULT NULL,
`cf` bigint(13) unsigned DEFAULT NULL,
`cc` bigint(13) unsigned DEFAULT NULL,
`cr` bigint(13) unsigned DEFAULT NULL,
`ct` bigint(13) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 1099511627775
cf 1099511627775
cc 1099511627775
cr 1099511627775
ct 1099511627775
----- -----
Type BIT(41)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(41) DEFAULT NULL,
`cf` bigint(13) unsigned DEFAULT NULL,
`cc` bigint(13) unsigned DEFAULT NULL,
`cr` bigint(13) unsigned DEFAULT NULL,
`ct` bigint(13) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 2199023255551
cf 2199023255551
cc 2199023255551
cr 2199023255551
ct 2199023255551
----- -----
Type BIT(42)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(42) DEFAULT NULL,
`cf` bigint(13) unsigned DEFAULT NULL,
`cc` bigint(13) unsigned DEFAULT NULL,
`cr` bigint(13) unsigned DEFAULT NULL,
`ct` bigint(13) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 4398046511103
cf 4398046511103
cc 4398046511103
cr 4398046511103
ct 4398046511103
----- -----
Type BIT(43)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(43) DEFAULT NULL,
`cf` bigint(13) unsigned DEFAULT NULL,
`cc` bigint(13) unsigned DEFAULT NULL,
`cr` bigint(13) unsigned DEFAULT NULL,
`ct` bigint(13) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 8796093022207
cf 8796093022207
cc 8796093022207
cr 8796093022207
ct 8796093022207
----- -----
Type BIT(44)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(44) DEFAULT NULL,
`cf` bigint(14) unsigned DEFAULT NULL,
`cc` bigint(14) unsigned DEFAULT NULL,
`cr` bigint(14) unsigned DEFAULT NULL,
`ct` bigint(14) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 17592186044415
cf 17592186044415
cc 17592186044415
cr 17592186044415
ct 17592186044415
----- -----
Type BIT(45)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(45) DEFAULT NULL,
`cf` bigint(14) unsigned DEFAULT NULL,
`cc` bigint(14) unsigned DEFAULT NULL,
`cr` bigint(14) unsigned DEFAULT NULL,
`ct` bigint(14) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 35184372088831
cf 35184372088831
cc 35184372088831
cr 35184372088831
ct 35184372088831
----- -----
Type BIT(46)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(46) DEFAULT NULL,
`cf` bigint(14) unsigned DEFAULT NULL,
`cc` bigint(14) unsigned DEFAULT NULL,
`cr` bigint(14) unsigned DEFAULT NULL,
`ct` bigint(14) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 70368744177663
cf 70368744177663
cc 70368744177663
cr 70368744177663
ct 70368744177663
----- -----
Type BIT(47)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(47) DEFAULT NULL,
`cf` bigint(15) unsigned DEFAULT NULL,
`cc` bigint(15) unsigned DEFAULT NULL,
`cr` bigint(15) unsigned DEFAULT NULL,
`ct` bigint(15) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 140737488355327
cf 140737488355327
cc 140737488355327
cr 140737488355327
ct 140737488355327
----- -----
Type BIT(48)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(48) DEFAULT NULL,
`cf` bigint(15) unsigned DEFAULT NULL,
`cc` bigint(15) unsigned DEFAULT NULL,
`cr` bigint(15) unsigned DEFAULT NULL,
`ct` bigint(15) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 281474976710655
cf 281474976710655
cc 281474976710655
cr 281474976710655
ct 281474976710655
----- -----
Type BIT(49)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(49) DEFAULT NULL,
`cf` bigint(15) unsigned DEFAULT NULL,
`cc` bigint(15) unsigned DEFAULT NULL,
`cr` bigint(15) unsigned DEFAULT NULL,
`ct` bigint(15) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 562949953421311
cf 562949953421311
cc 562949953421311
cr 562949953421311
ct 562949953421311
----- -----
Type BIT(50)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(50) DEFAULT NULL,
`cf` bigint(16) unsigned DEFAULT NULL,
`cc` bigint(16) unsigned DEFAULT NULL,
`cr` bigint(16) unsigned DEFAULT NULL,
`ct` bigint(16) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 1125899906842623
cf 1125899906842623
cc 1125899906842623
cr 1125899906842623
ct 1125899906842623
----- -----
Type BIT(51)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(51) DEFAULT NULL,
`cf` bigint(16) unsigned DEFAULT NULL,
`cc` bigint(16) unsigned DEFAULT NULL,
`cr` bigint(16) unsigned DEFAULT NULL,
`ct` bigint(16) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 2251799813685247
cf 2251799813685247
cc 2251799813685247
cr 2251799813685247
ct 2251799813685247
----- -----
Type BIT(52)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(52) DEFAULT NULL,
`cf` bigint(16) unsigned DEFAULT NULL,
`cc` bigint(16) unsigned DEFAULT NULL,
`cr` bigint(16) unsigned DEFAULT NULL,
`ct` bigint(16) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 4503599627370495
cf 4503599627370495
cc 4503599627370495
cr 4503599627370495
ct 4503599627370495
----- -----
Type BIT(53)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(53) DEFAULT NULL,
`cf` bigint(16) unsigned DEFAULT NULL,
`cc` bigint(16) unsigned DEFAULT NULL,
`cr` bigint(16) unsigned DEFAULT NULL,
`ct` bigint(16) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 9007199254740991
cf 9007199254740991
cc 9007199254740991
cr 9007199254740991
ct 9007199254740991
----- -----
Type BIT(54)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(54) DEFAULT NULL,
`cf` bigint(17) unsigned DEFAULT NULL,
`cc` bigint(17) unsigned DEFAULT NULL,
`cr` bigint(17) unsigned DEFAULT NULL,
`ct` bigint(17) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 18014398509481983
cf 18014398509481983
cc 18014398509481983
cr 18014398509481983
ct 18014398509481983
----- -----
Type BIT(55)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(55) DEFAULT NULL,
`cf` bigint(17) unsigned DEFAULT NULL,
`cc` bigint(17) unsigned DEFAULT NULL,
`cr` bigint(17) unsigned DEFAULT NULL,
`ct` bigint(17) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 36028797018963967
cf 36028797018963967
cc 36028797018963967
cr 36028797018963967
ct 36028797018963967
----- -----
Type BIT(56)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(56) DEFAULT NULL,
`cf` bigint(17) unsigned DEFAULT NULL,
`cc` bigint(17) unsigned DEFAULT NULL,
`cr` bigint(17) unsigned DEFAULT NULL,
`ct` bigint(17) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 72057594037927935
cf 72057594037927935
cc 72057594037927935
cr 72057594037927935
ct 72057594037927935
----- -----
Type BIT(57)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(57) DEFAULT NULL,
`cf` bigint(18) unsigned DEFAULT NULL,
`cc` bigint(18) unsigned DEFAULT NULL,
`cr` bigint(18) unsigned DEFAULT NULL,
`ct` bigint(18) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 144115188075855871
cf 144115188075855871
cc 144115188075855871
cr 144115188075855871
ct 144115188075855871
----- -----
Type BIT(58)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(58) DEFAULT NULL,
`cf` bigint(18) unsigned DEFAULT NULL,
`cc` bigint(18) unsigned DEFAULT NULL,
`cr` bigint(18) unsigned DEFAULT NULL,
`ct` bigint(18) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 288230376151711743
cf 288230376151711743
cc 288230376151711743
cr 288230376151711743
ct 288230376151711743
----- -----
Type BIT(59)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(59) DEFAULT NULL,
`cf` bigint(18) unsigned DEFAULT NULL,
`cc` bigint(18) unsigned DEFAULT NULL,
`cr` bigint(18) unsigned DEFAULT NULL,
`ct` bigint(18) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 576460752303423487
cf 576460752303423487
cc 576460752303423487
cr 576460752303423487
ct 576460752303423487
----- -----
Type BIT(60)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(60) DEFAULT NULL,
`cf` bigint(19) unsigned DEFAULT NULL,
`cc` bigint(19) unsigned DEFAULT NULL,
`cr` bigint(19) unsigned DEFAULT NULL,
`ct` bigint(19) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 1152921504606846975
cf 1152921504606846975
cc 1152921504606846975
cr 1152921504606846975
ct 1152921504606846975
----- -----
Type BIT(61)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(61) DEFAULT NULL,
`cf` bigint(19) unsigned DEFAULT NULL,
`cc` bigint(19) unsigned DEFAULT NULL,
`cr` bigint(19) unsigned DEFAULT NULL,
`ct` bigint(19) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 2305843009213693951
cf 2305843009213693951
cc 2305843009213693951
cr 2305843009213693951
ct 2305843009213693951
----- -----
Type BIT(62)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(62) DEFAULT NULL,
`cf` bigint(19) unsigned DEFAULT NULL,
`cc` bigint(19) unsigned DEFAULT NULL,
`cr` bigint(19) unsigned DEFAULT NULL,
`ct` bigint(19) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 4611686018427387903
cf 4611686018427387903
cc 4611686018427387903
cr 4611686018427387903
ct 4611686018427387903
----- -----
Type BIT(63)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(63) DEFAULT NULL,
`cf` bigint(19) unsigned DEFAULT NULL,
`cc` bigint(19) unsigned DEFAULT NULL,
`cr` bigint(19) unsigned DEFAULT NULL,
`ct` bigint(19) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 9223372036854775807
cf 9223372036854775807
cc 9223372036854775807
cr 9223372036854775807
ct 9223372036854775807
----- -----
Type BIT(64)
Table t2
Create Table CREATE TABLE `t2` (
`a` bit(64) DEFAULT NULL,
`cf` bigint(20) unsigned DEFAULT NULL,
`cc` bigint(20) unsigned DEFAULT NULL,
`cr` bigint(20) unsigned DEFAULT NULL,
`ct` bigint(20) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 18446744073709551615
cf 18446744073709551615
cc 18446744073709551615
cr 18446744073709551615
ct 18446744073709551615
#
# End of 10.4 tests # End of 10.4 tests
# #
...@@ -507,6 +507,35 @@ EXPLAIN SELECT * FROM t1 WHERE a=200; ...@@ -507,6 +507,35 @@ EXPLAIN SELECT * FROM t1 WHERE a=200;
EXPLAIN SELECT * FROM t1 WHERE a<=>200; EXPLAIN SELECT * FROM t1 WHERE a<=>200;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-23323 Rounding functions return a wrong data type for a BIT, ENUM, SET argument
--echo #
--vertical_results
DELIMITER $$;
BEGIN NOT ATOMIC
FOR i IN 1..64
DO
SELECT '-----', CONCAT('BIT(',i,')') AS Type;
EXECUTE IMMEDIATE REPLACE('CREATE TABLE t1 (a BIT(64))','64', i);
INSERT IGNORE INTO t1 VALUES (0xFFFFFFFFFFFFFFFF);
CREATE TABLE t2 AS SELECT
a,
FLOOR(a) AS cf,
CEILING(a) AS cc,
ROUND(a) AS cr,
TRUNCATE(a,0) AS ct
FROM t1;
SHOW CREATE TABLE t2;
SELECT CAST(a AS UNSIGNED) AS a, cf, cc, cr, ct FROM t2;
DROP TABLE t2;
DROP TABLE t1;
END FOR;
END;
$$
DELIMITER ;$$
--horizontal_results
--echo # --echo #
--echo # End of 10.4 tests --echo # End of 10.4 tests
......
...@@ -2311,3 +2311,24 @@ t2 CREATE TABLE `t2` ( ...@@ -2311,3 +2311,24 @@ t2 CREATE TABLE `t2` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP PROCEDURE p1; DROP PROCEDURE p1;
DROP TABLE t1; DROP TABLE t1;
#
# MDEV-23323 Rounding functions return a wrong data type for a BIT, ENUM, SET argument
#
CREATE TABLE t1 (a ENUM('999999999999999999999999999999999999999999999999999999999999'));
INSERT INTO t1 VALUES (1);
CREATE TABLE t2 AS
SELECT a, FLOOR(a), CEILING(a), TRUNCATE(a,0), ROUND(a) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` enum('999999999999999999999999999999999999999999999999999999999999') DEFAULT NULL,
`FLOOR(a)` int(5) unsigned DEFAULT NULL,
`CEILING(a)` int(5) unsigned DEFAULT NULL,
`TRUNCATE(a,0)` int(5) unsigned DEFAULT NULL,
`ROUND(a)` int(5) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t2;
a FLOOR(a) CEILING(a) TRUNCATE(a,0) ROUND(a)
999999999999999999999999999999999999999999999999999999999999 1 1 1 1
DROP TABLE t2;
DROP TABLE t1;
......
...@@ -518,3 +518,16 @@ DELIMITER ;$$ ...@@ -518,3 +518,16 @@ DELIMITER ;$$
CALL p1(); CALL p1();
DROP PROCEDURE p1; DROP PROCEDURE p1;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-23323 Rounding functions return a wrong data type for a BIT, ENUM, SET argument
--echo #
CREATE TABLE t1 (a ENUM('999999999999999999999999999999999999999999999999999999999999'));
INSERT INTO t1 VALUES (1);
CREATE TABLE t2 AS
SELECT a, FLOOR(a), CEILING(a), TRUNCATE(a,0), ROUND(a) FROM t1;
SHOW CREATE TABLE t2;
SELECT * FROM t2;
DROP TABLE t2;
DROP TABLE t1;
......
...@@ -358,3 +358,24 @@ DROP TABLE t1; ...@@ -358,3 +358,24 @@ DROP TABLE t1;
SET NAMES utf8; SET NAMES utf8;
CREATE TABLE t1 (a SET('a,bü')); CREATE TABLE t1 (a SET('a,bü'));
ERROR 22007: Illegal set 'a,bü' value found during parsing ERROR 22007: Illegal set 'a,bü' value found during parsing
#
# MDEV-23323 Rounding functions return a wrong data type for a BIT, ENUM, SET argument
#
CREATE TABLE t1 (a SET('999999999999999999999999999999999999999999999999999999999999'));
INSERT INTO t1 VALUES (1);
CREATE TABLE t2 AS
SELECT a, FLOOR(a), CEILING(a), TRUNCATE(a,0), ROUND(a) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` set('999999999999999999999999999999999999999999999999999999999999') DEFAULT NULL,
`FLOOR(a)` int(5) unsigned DEFAULT NULL,
`CEILING(a)` int(5) unsigned DEFAULT NULL,
`TRUNCATE(a,0)` int(5) unsigned DEFAULT NULL,
`ROUND(a)` int(5) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t2;
a FLOOR(a) CEILING(a) TRUNCATE(a,0) ROUND(a)
999999999999999999999999999999999999999999999999999999999999 1 1 1 1
DROP TABLE t2;
DROP TABLE t1;
...@@ -248,3 +248,16 @@ DROP TABLE t1; ...@@ -248,3 +248,16 @@ DROP TABLE t1;
SET NAMES utf8; SET NAMES utf8;
--error ER_ILLEGAL_VALUE_FOR_TYPE --error ER_ILLEGAL_VALUE_FOR_TYPE
CREATE TABLE t1 (a SET('a,bü')); CREATE TABLE t1 (a SET('a,bü'));
--echo #
--echo # MDEV-23323 Rounding functions return a wrong data type for a BIT, ENUM, SET argument
--echo #
CREATE TABLE t1 (a SET('999999999999999999999999999999999999999999999999999999999999'));
INSERT INTO t1 VALUES (1);
CREATE TABLE t2 AS
SELECT a, FLOOR(a), CEILING(a), TRUNCATE(a,0), ROUND(a) FROM t1;
SHOW CREATE TABLE t2;
SELECT * FROM t2;
DROP TABLE t2;
DROP TABLE t1;
...@@ -2218,9 +2218,13 @@ bool Item_func_int_val::fix_length_and_dec() ...@@ -2218,9 +2218,13 @@ bool Item_func_int_val::fix_length_and_dec()
{ {
DBUG_ENTER("Item_func_int_val::fix_length_and_dec"); DBUG_ENTER("Item_func_int_val::fix_length_and_dec");
DBUG_PRINT("info", ("name %s", func_name())); DBUG_PRINT("info", ("name %s", func_name()));
if (args[0]->type_handler()->Item_func_int_val_fix_length_and_dec(this)) /*
We don't want to translate ENUM/SET to CHAR here.
So let's call real_type_handler(), not type_handler().
*/
if (args[0]->real_type_handler()->Item_func_int_val_fix_length_and_dec(this))
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
DBUG_PRINT("info", ("Type: %s", type_handler()->name().ptr())); DBUG_PRINT("info", ("Type: %s", real_type_handler()->name().ptr()));
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
} }
......
...@@ -458,6 +458,29 @@ class Item_hybrid_func: public Item_func, ...@@ -458,6 +458,29 @@ class Item_hybrid_func: public Item_func,
{ {
Type_geometry_attributes::set_geometry_type(type); Type_geometry_attributes::set_geometry_type(type);
} }
void fix_length_and_dec_long_or_longlong(uint char_length, bool unsigned_arg)
{
collation.set_numeric();
unsigned_flag= unsigned_arg;
max_length= char_length;
#if MARIADB_VERSION_ID < 100500
set_handler(Type_handler::type_handler_long_or_longlong(char_length));
#else
set_handler(Type_handler::type_handler_long_or_longlong(char_length,
unsigned_arg));
#endif
}
void fix_length_and_dec_ulong_or_ulonglong_by_nbits(uint nbits)
{
uint digits= Type_handler_bit::Bit_decimal_notation_int_digits_by_nbits(nbits);
collation.set_numeric();
unsigned_flag= true;
max_length= digits;
if (nbits > 32)
set_handler(&type_handler_longlong);
else
set_handler(&type_handler_long);
}
}; };
...@@ -1758,7 +1781,11 @@ class Item_func_round :public Item_func_hybrid_field_type ...@@ -1758,7 +1781,11 @@ class Item_func_round :public Item_func_hybrid_field_type
void fix_arg_temporal(const Type_handler *h, uint int_part_length); void fix_arg_temporal(const Type_handler *h, uint int_part_length);
bool fix_length_and_dec() bool fix_length_and_dec()
{ {
return args[0]->type_handler()->Item_func_round_fix_length_and_dec(this); /*
We don't want to translate ENUM/SET to CHAR here.
So let's real_type_handler(), not type_handler().
*/
return args[0]->real_type_handler()->Item_func_round_fix_length_and_dec(this);
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd)
{ return get_item_copy<Item_func_round>(thd, this); } { return get_item_copy<Item_func_round>(thd, this); }
......
...@@ -3536,7 +3536,7 @@ uint32 ...@@ -3536,7 +3536,7 @@ uint32
Type_handler_bit::Item_decimal_notation_int_digits(const Item *item) Type_handler_bit::Item_decimal_notation_int_digits(const Item *item)
const const
{ {
return Bit_decimal_notation_int_digits(item); return Bit_decimal_notation_int_digits_by_nbits(item->max_length);
} }
...@@ -3554,9 +3554,23 @@ Type_handler_general_purpose_int::Item_decimal_notation_int_digits( ...@@ -3554,9 +3554,23 @@ Type_handler_general_purpose_int::Item_decimal_notation_int_digits(
a divisor. a divisor.
*/ */
uint32 uint32
Type_handler_bit::Bit_decimal_notation_int_digits(const Item *item) Type_handler_bit::Bit_decimal_notation_int_digits_by_nbits(uint nbits)
{ {
return item->max_length/3+1; DBUG_ASSERT(nbits > 0);
DBUG_ASSERT(nbits <= 64);
set_if_smaller(nbits, 64); // Safety
static uint ndigits[65]=
{0,
1,1,1,2,2,2,3,3, // 1..8 bits
3,4,4,4,4,5,5,5, // 9..16 bits
6,6,6,7,7,7,7,8, // 17..24 bits
8,8,9,9,9,10,10,10, // 25..32 bits
10,11,11,11,12,12,12,13, // 33..40 bits
13,13,13,14,14,14,15,15, // 41..48 bits
15,16,16,16,16,17,17,17, // 49..56 bits
18,18,18,19,19,19,19,20 // 57..64 bits
};
return ndigits[nbits];
} }
/*************************************************************************/ /*************************************************************************/
...@@ -5658,6 +5672,23 @@ bool Type_handler_hex_hybrid:: ...@@ -5658,6 +5672,23 @@ bool Type_handler_hex_hybrid::
} }
bool Type_handler_bit::
Item_func_round_fix_length_and_dec(Item_func_round *item) const
{
uint nbits= item->arguments()[0]->max_length;
item->fix_length_and_dec_ulong_or_ulonglong_by_nbits(nbits);
return false;
}
bool Type_handler_typelib::
Item_func_round_fix_length_and_dec(Item_func_round *item) const
{
item->fix_length_and_dec_long_or_longlong(5, true);
return false;
}
bool Type_handler_real_result:: bool Type_handler_real_result::
Item_func_round_fix_length_and_dec(Item_func_round *item) const Item_func_round_fix_length_and_dec(Item_func_round *item) const
{ {
...@@ -5740,10 +5771,19 @@ bool Type_handler_int_result:: ...@@ -5740,10 +5771,19 @@ bool Type_handler_int_result::
} }
bool Type_handler_bit::
Item_func_int_val_fix_length_and_dec(Item_func_int_val *item) const
{
uint nbits= item->arguments()[0]->max_length;
item->fix_length_and_dec_ulong_or_ulonglong_by_nbits(nbits);
return false;
}
bool Type_handler_typelib:: bool Type_handler_typelib::
Item_func_int_val_fix_length_and_dec(Item_func_int_val *item) const Item_func_int_val_fix_length_and_dec(Item_func_int_val *item) const
{ {
item->fix_length_and_dec_int_or_decimal(); item->fix_length_and_dec_long_or_longlong(5, true);
return false; return false;
} }
...@@ -5751,14 +5791,8 @@ bool Type_handler_typelib:: ...@@ -5751,14 +5791,8 @@ bool Type_handler_typelib::
bool Type_handler_hex_hybrid:: bool Type_handler_hex_hybrid::
Item_func_int_val_fix_length_and_dec(Item_func_int_val *item) const Item_func_int_val_fix_length_and_dec(Item_func_int_val *item) const
{ {
item->collation.set_numeric(); uint nchars= item->arguments()[0]->decimal_precision();
item->unsigned_flag= true; item->fix_length_and_dec_long_or_longlong(nchars, true);
item->max_length= item->arguments()[0]->decimal_precision();
#if MARIADB_VERSION_ID < 100500
item->set_handler(type_handler_long_or_longlong(item->max_length));
#else
item->set_handler(type_handler_long_or_longlong(item->max_length, true));
#endif
return false; return false;
} }
......
...@@ -5147,7 +5147,7 @@ class Type_handler_bit: public Type_handler_int_result ...@@ -5147,7 +5147,7 @@ class Type_handler_bit: public Type_handler_int_result
} }
uint32 max_display_length(const Item *item) const; uint32 max_display_length(const Item *item) const;
uint32 Item_decimal_notation_int_digits(const Item *item) const; uint32 Item_decimal_notation_int_digits(const Item *item) const;
static uint32 Bit_decimal_notation_int_digits(const Item *item); static uint32 Bit_decimal_notation_int_digits_by_nbits(uint nbits);
uint32 calc_pack_length(uint32 length) const { return length / 8; } uint32 calc_pack_length(uint32 length) const { return length / 8; }
bool Item_send(Item *item, Protocol *protocol, st_value *buf) const bool Item_send(Item *item, Protocol *protocol, st_value *buf) const
{ {
...@@ -5157,6 +5157,8 @@ class Type_handler_bit: public Type_handler_int_result ...@@ -5157,6 +5157,8 @@ class Type_handler_bit: public Type_handler_int_result
{ {
return print_item_value_csstr(thd, item, str); return print_item_value_csstr(thd, item, str);
} }
bool Item_func_round_fix_length_and_dec(Item_func_round *) const;
bool Item_func_int_val_fix_length_and_dec(Item_func_int_val *) const;
Field *make_conversion_table_field(TABLE *, uint metadata, Field *make_conversion_table_field(TABLE *, uint metadata,
const Field *target) const; const Field *target) const;
bool Column_definition_fix_attributes(Column_definition *c) const; bool Column_definition_fix_attributes(Column_definition *c) const;
...@@ -6271,6 +6273,7 @@ class Type_handler_typelib: public Type_handler_general_purpose_string ...@@ -6271,6 +6273,7 @@ class Type_handler_typelib: public Type_handler_general_purpose_string
enum_field_types field_type() const { return MYSQL_TYPE_STRING; } enum_field_types field_type() const { return MYSQL_TYPE_STRING; }
const Type_handler *type_handler_for_item_field() const; const Type_handler *type_handler_for_item_field() const;
const Type_handler *cast_to_int_type_handler() const; const Type_handler *cast_to_int_type_handler() const;
bool Item_func_round_fix_length_and_dec(Item_func_round *) const;
bool Item_func_int_val_fix_length_and_dec(Item_func_int_val *) const; bool Item_func_int_val_fix_length_and_dec(Item_func_int_val *) const;
bool Item_hybrid_func_fix_attributes(THD *thd, bool Item_hybrid_func_fix_attributes(THD *thd,
const char *name, const char *name,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment