Skip to content

Commit

Permalink
MDEV-12854 Synchronize CREATE..SELECT data type and result set metada…
Browse files Browse the repository at this point in the history
…ta data type for INT functions
  • Loading branch information
Alexander Barkov committed May 20, 2017
1 parent d2fec34 commit a8caa8e
Show file tree
Hide file tree
Showing 33 changed files with 800 additions and 227 deletions.
10 changes: 5 additions & 5 deletions mysql-test/r/ctype_binary.result
Expand Up @@ -382,7 +382,7 @@ create table t1 as select concat(sign(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varbinary(21) DEFAULT NULL
`c1` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(rand()) as c1;
Expand Down Expand Up @@ -419,7 +419,7 @@ create table t1 as select concat(bit_length('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varbinary(10) DEFAULT NULL
`c1` varbinary(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(coercibility('a')));
Expand Down Expand Up @@ -469,7 +469,7 @@ create table t1 as select concat(ord(61)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varbinary(21) DEFAULT NULL
`c1` varbinary(7) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(find_in_set('b','a,b,c,d')));
Expand Down Expand Up @@ -696,7 +696,7 @@ create table t1 as select concat(sleep(0)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varbinary(21) DEFAULT NULL
`c1` varbinary(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(is_free_lock('xxxx')));
Expand Down Expand Up @@ -1447,7 +1447,7 @@ create table t1 as select concat(microsecond('12:00:00.123456')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varbinary(21) DEFAULT NULL
`c1` varbinary(6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(month(20090224)));
Expand Down
10 changes: 5 additions & 5 deletions mysql-test/r/ctype_cp1251.result
Expand Up @@ -791,7 +791,7 @@ create table t1 as select concat(sign(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL
`c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(rand()) as c1;
Expand Down Expand Up @@ -828,7 +828,7 @@ create table t1 as select concat(bit_length('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL
`c1` varchar(11) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(coercibility('a')));
Expand Down Expand Up @@ -878,7 +878,7 @@ create table t1 as select concat(ord(61)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL
`c1` varchar(7) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(find_in_set('b','a,b,c,d')));
Expand Down Expand Up @@ -1105,7 +1105,7 @@ create table t1 as select concat(sleep(0)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL
`c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(is_free_lock('xxxx')));
Expand Down Expand Up @@ -1856,7 +1856,7 @@ create table t1 as select concat(microsecond('12:00:00.123456')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL
`c1` varchar(6) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(month(20090224)));
Expand Down
10 changes: 5 additions & 5 deletions mysql-test/r/ctype_latin1.result
Expand Up @@ -1088,7 +1088,7 @@ create table t1 as select concat(sign(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(21) DEFAULT NULL
`c1` varchar(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(rand()) as c1;
Expand Down Expand Up @@ -1125,7 +1125,7 @@ create table t1 as select concat(bit_length('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(10) DEFAULT NULL
`c1` varchar(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(coercibility('a')));
Expand Down Expand Up @@ -1175,7 +1175,7 @@ create table t1 as select concat(ord(61)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(21) DEFAULT NULL
`c1` varchar(7) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(find_in_set('b','a,b,c,d')));
Expand Down Expand Up @@ -1402,7 +1402,7 @@ create table t1 as select concat(sleep(0)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(21) DEFAULT NULL
`c1` varchar(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(is_free_lock('xxxx')));
Expand Down Expand Up @@ -2153,7 +2153,7 @@ create table t1 as select concat(microsecond('12:00:00.123456')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(21) DEFAULT NULL
`c1` varchar(6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(month(20090224)));
Expand Down
10 changes: 5 additions & 5 deletions mysql-test/r/ctype_ucs.result
Expand Up @@ -1967,7 +1967,7 @@ create table t1 as select concat(sign(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL
`c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(rand()) as c1;
Expand Down Expand Up @@ -2004,7 +2004,7 @@ create table t1 as select concat(bit_length('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
`c1` varchar(11) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(coercibility('a')));
Expand Down Expand Up @@ -2054,7 +2054,7 @@ create table t1 as select concat(ord(61)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL
`c1` varchar(7) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(find_in_set('b','a,b,c,d')));
Expand Down Expand Up @@ -2281,7 +2281,7 @@ create table t1 as select concat(sleep(0)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL
`c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(is_free_lock('xxxx')));
Expand Down Expand Up @@ -3032,7 +3032,7 @@ create table t1 as select concat(microsecond('12:00:00.123456')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL
`c1` varchar(6) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(month(20090224)));
Expand Down
10 changes: 5 additions & 5 deletions mysql-test/r/ctype_utf8.result
Expand Up @@ -2839,7 +2839,7 @@ create table t1 as select concat(sign(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL
`c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(rand()) as c1;
Expand Down Expand Up @@ -2876,7 +2876,7 @@ create table t1 as select concat(bit_length('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
`c1` varchar(11) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(coercibility('a')));
Expand Down Expand Up @@ -2926,7 +2926,7 @@ create table t1 as select concat(ord(61)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL
`c1` varchar(7) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(find_in_set('b','a,b,c,d')));
Expand Down Expand Up @@ -3153,7 +3153,7 @@ create table t1 as select concat(sleep(0)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL
`c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(is_free_lock('xxxx')));
Expand Down Expand Up @@ -3904,7 +3904,7 @@ create table t1 as select concat(microsecond('12:00:00.123456')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL
`c1` varchar(6) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(month(20090224)));
Expand Down
26 changes: 26 additions & 0 deletions mysql-test/r/func_json.result
Expand Up @@ -642,3 +642,29 @@ SELECT JSON_KEYS(f) FROM t1 ORDER BY 1;
JSON_KEYS(f)
NULL
DROP TABLE t1;
#
# Start of 10.3 tests
#
#
# MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions
#
SELECT
JSON_VALID('{"id": 1, "name": "Monty"}') AS json_valid,
JSON_EXISTS('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2") AS json_exists,
JSON_CONTAINS('{"A": 0, "B": {"C": 1}, "D": 2}', '2', '$.A') AS ison_contains,
JSON_CONTAINS_PATH('{"A": 1, "B": [2], "C": [3, 4]}', 'one', '$.A', '$.D') AS json_contains_path;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def json_valid 3 1 1 Y 32896 0 63
def json_exists 3 1 1 Y 32896 0 63
def ison_contains 3 1 1 Y 32896 0 63
def json_contains_path 3 1 1 Y 32896 0 63
json_valid json_exists ison_contains json_contains_path
1 1 0 1
SELECT
JSON_LENGTH('{"a": 1, "b": {"c": 30}}') AS json_length,
JSON_DEPTH('[10, {"a": 20}]') AS json_depnth;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def json_length 3 10 1 Y 32896 0 63
def json_depnth 3 10 1 N 32897 0 63
json_length json_depnth
2 3
11 changes: 11 additions & 0 deletions mysql-test/r/func_misc.result
Expand Up @@ -1494,3 +1494,14 @@ DROP TABLE t1;
#
# End of 10.2 tests
#
#
# Start of 10.3 tests
#
#
# MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions
#
SELECT INET_ATON("255.255.255.255.255.255.255.255");
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def INET_ATON("255.255.255.255.255.255.255.255") 8 21 20 Y 32928 0 63
INET_ATON("255.255.255.255.255.255.255.255")
18446744073709551615
23 changes: 23 additions & 0 deletions mysql-test/r/gis.result
Expand Up @@ -4318,5 +4318,28 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
#
# MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions
#
SELECT
ST_ISSIMPLE(POINT(1,1)),
ST_ISRING(POINT(1,1)),
ST_ISCLOSED(POINT(1,1)),
ST_DIMENSION(POINT(1,1)),
ST_NUMGEOMETRIES(POINT(1,1)),
ST_NUMINTERIORRINGS(POINT(1,1)),
ST_NUMPOINTS(POINT(1,1)),
ST_SRID(POINT(1,1));
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def ST_ISSIMPLE(POINT(1,1)) 3 2 1 Y 32896 0 63
def ST_ISRING(POINT(1,1)) 3 2 2 Y 32896 0 63
def ST_ISCLOSED(POINT(1,1)) 3 2 2 Y 32896 0 63
def ST_DIMENSION(POINT(1,1)) 3 10 1 Y 32896 0 63
def ST_NUMGEOMETRIES(POINT(1,1)) 3 10 0 Y 32896 0 63
def ST_NUMINTERIORRINGS(POINT(1,1)) 3 10 0 Y 32896 0 63
def ST_NUMPOINTS(POINT(1,1)) 3 10 0 Y 32896 0 63
def ST_SRID(POINT(1,1)) 3 10 1 Y 32896 0 63
ST_ISSIMPLE(POINT(1,1)) ST_ISRING(POINT(1,1)) ST_ISCLOSED(POINT(1,1)) ST_DIMENSION(POINT(1,1)) ST_NUMGEOMETRIES(POINT(1,1)) ST_NUMINTERIORRINGS(POINT(1,1)) ST_NUMPOINTS(POINT(1,1)) ST_SRID(POINT(1,1))
1 -1 -1 0 NULL NULL NULL 0
#
# End of 10.3 tests
#

0 comments on commit a8caa8e

Please sign in to comment.