1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#
# MDEV-27018 IF and COALESCE lose "json" property
#
CREATE TABLE t1 (a INET6, b JSON, c LONGTEXT);
INSERT INTO t1 VALUES ('::', '{"b": "b"}', '{"c": "c"}');
SELECT
COALESCE(a,b), COALESCE(a,c),
LEAST(a,b), LEAST(a,c)
FROM t1 LIMIT 0;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def COALESCE(a,b) 254 (type=inet6) 39 0 Y 32 0 8
def COALESCE(a,c) 254 (type=inet6) 39 0 Y 32 0 8
def LEAST(a,b) 254 (type=inet6) 39 0 Y 32 0 8
def LEAST(a,c) 254 (type=inet6) 39 0 Y 32 0 8
COALESCE(a,b) COALESCE(a,c) LEAST(a,b) LEAST(a,c)
CREATE TABLE t2 AS
SELECT
COALESCE(a,b), COALESCE(a,c),
LEAST(a,b), LEAST(a,c)
FROM t1 LIMIT 0;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`COALESCE(a,b)` inet6 DEFAULT NULL,
`COALESCE(a,c)` inet6 DEFAULT NULL,
`LEAST(a,b)` inet6 DEFAULT NULL,
`LEAST(a,c)` inet6 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
SELECT * FROM t1 WHERE a=b;
a b c
Warnings:
Warning 1292 Incorrect inet6 value: '{"b": "b"}'
SELECT * FROM t1 WHERE a=c;
a b c
Warnings:
Warning 1292 Incorrect inet6 value: '{"c": "c"}'
SELECT a+b FROM t1;
ERROR HY000: Illegal parameter data types inet6 and longblob/json for operation '+'
SELECT a+c FROM t1;
ERROR HY000: Illegal parameter data types inet6 and longblob for operation '+'
DROP TABLE t1;
|