Skip to content

Commit 41da3ca

Browse files
author
Alexander Barkov
committed
Merge remote-tracking branch 'origin/bb-10.2-ext' into 10.3
2 parents 4e1e5a3 + b652430 commit 41da3ca

19 files changed

+864
-276
lines changed

CMakeLists.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,23 @@ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/mysql_version.h.in
442442
${CMAKE_BINARY_DIR}/include/mysql_version.h )
443443
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/sql/sql_builtin.cc.in
444444
${CMAKE_BINARY_DIR}/sql/sql_builtin.cc)
445+
446+
FIND_PACKAGE(Git)
447+
IF(GIT_EXECUTABLE)
448+
EXECUTE_PROCESS(
449+
COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
450+
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
451+
OUTPUT_VARIABLE OUT RESULT_VARIABLE RES)
452+
IF(RES EQUAL 0)
453+
STRING(REGEX REPLACE "\n$" "" SOURCE_REVISION "${OUT}")
454+
ENDIF()
455+
ENDIF()
456+
IF(SOURCE_REVISION OR
457+
(NOT EXISTS ${PROJECT_SOURCE_DIR}/include/source_revision.h))
458+
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/include/source_revision.h.in
459+
${PROJECT_BINARY_DIR}/include/source_revision.h )
460+
ENDIF()
461+
445462
CONFIGURE_FILE(
446463
${CMAKE_SOURCE_DIR}/cmake/info_macros.cmake.in
447464
${CMAKE_BINARY_DIR}/info_macros.cmake @ONLY)

client/mysql.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
#include "my_readline.h"
4141
#include <signal.h>
4242
#include <violite.h>
43-
43+
#include <source_revision.h>
4444
#if defined(USE_LIBEDIT_INTERFACE) && defined(HAVE_LOCALE_H)
4545
#include <locale.h>
4646
#endif
@@ -1719,8 +1719,8 @@ static void usage(int version)
17191719
my_progname, VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE,
17201720
readline, rl_library_version);
17211721
#else
1722-
printf("%s Ver %s Distrib %s, for %s (%s)\n", my_progname, VER,
1723-
MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
1722+
printf("%s Ver %s Distrib %s, for %s (%s), source revision %s\n", my_progname, VER,
1723+
MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE,SOURCE_REVISION);
17241724
#endif
17251725

17261726
if (version)

cmake/make_dist.cmake.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ IF(GIT_EXECUTABLE)
5252
ENDIF()
5353
ENDIF()
5454

55+
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/include/source_revision.h
56+
${PACKAGE_DIR}/include/source_revision.h COPYONLY)
57+
5558
IF(NOT GIT_EXECUTABLE)
5659
MESSAGE(STATUS "git not found or source dir is not a repo, use CPack")
5760

include/source_revision.h.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#cmakedefine SOURCE_REVISION "@SOURCE_REVISION@"

mysql-test/r/case.result

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,3 +447,51 @@ EXECUTE stmt;
447447
good was_bad_now_good
448448
one one
449449
DEALLOCATE PREPARE stmt;
450+
#
451+
# MDEV-13864 Change Item_func_case to store the predicant in args[0]
452+
#
453+
SET NAMES latin1;
454+
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1);
455+
INSERT INTO t1 VALUES ('a'),('b'),('c');
456+
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND CASE a WHEN 'a' THEN 'a' ELSE 'a' END='a';
457+
id select_type table type possible_keys key key_len ref rows filtered Extra
458+
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
459+
Warnings:
460+
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a'
461+
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND CASE 'a' WHEN a THEN 'a' ELSE 'a' END='a';
462+
id select_type table type possible_keys key key_len ref rows filtered Extra
463+
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
464+
Warnings:
465+
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a'
466+
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND CASE 'a' WHEN 'a' THEN a ELSE 'a' END='a';
467+
id select_type table type possible_keys key key_len ref rows filtered Extra
468+
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
469+
Warnings:
470+
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' and (case 'a' when 'a' then `test`.`t1`.`a` else 'a' end) = 'a'
471+
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND CASE 'a' WHEN 'a' THEN 'a' ELSE a END='a';
472+
id select_type table type possible_keys key key_len ref rows filtered Extra
473+
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
474+
Warnings:
475+
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' and (case 'a' when 'a' then 'a' else `test`.`t1`.`a` end) = 'a'
476+
ALTER TABLE t1 MODIFY a VARBINARY(10);
477+
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND CASE a WHEN 'a' THEN 'a' ELSE 'a' END='a';
478+
id select_type table type possible_keys key key_len ref rows filtered Extra
479+
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
480+
Warnings:
481+
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a'
482+
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND CASE 'a' WHEN a THEN 'a' ELSE 'a' END='a';
483+
id select_type table type possible_keys key key_len ref rows filtered Extra
484+
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
485+
Warnings:
486+
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a'
487+
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND CASE 'a' WHEN 'a' THEN a ELSE 'a' END='a';
488+
id select_type table type possible_keys key key_len ref rows filtered Extra
489+
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
490+
Warnings:
491+
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a'
492+
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND CASE 'a' WHEN 'a' THEN 'a' ELSE a END='a';
493+
id select_type table type possible_keys key key_len ref rows filtered Extra
494+
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
495+
Warnings:
496+
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a'
497+
DROP TABLE t1;

mysql-test/r/func_debug.result

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1629,8 +1629,8 @@ WHEN -9223372036854775808 THEN 'one'
16291629
c
16301630
NULL
16311631
Warnings:
1632-
Note 1105 DBUG: [0] arg=0 handler=0 (bigint)
1633-
Note 1105 DBUG: [1] arg=2 handler=1 (decimal)
1632+
Note 1105 DBUG: [0] arg=1 handler=0 (bigint)
1633+
Note 1105 DBUG: [1] arg=3 handler=1 (decimal)
16341634
DROP TABLE t1;
16351635
#
16361636
# MDEV-11555 CASE with a mixture of TIME and DATETIME returns a wrong result
@@ -1648,10 +1648,10 @@ CASE TIME'10:20:30'
16481648
good was_bad_now_good
16491649
one one
16501650
Warnings:
1651-
Note 1105 DBUG: [0] arg=0 handler=0 (time)
1652-
Note 1105 DBUG: [1] arg=2 handler=0 (time)
1653-
Note 1105 DBUG: [0] arg=0 handler=0 (time)
1654-
Note 1105 DBUG: [1] arg=2 handler=0 (time)
1655-
Note 1105 DBUG: [2] arg=4 handler=2 (datetime)
1651+
Note 1105 DBUG: [0] arg=1 handler=0 (time)
1652+
Note 1105 DBUG: [1] arg=3 handler=0 (time)
1653+
Note 1105 DBUG: [0] arg=1 handler=0 (time)
1654+
Note 1105 DBUG: [1] arg=3 handler=0 (time)
1655+
Note 1105 DBUG: [2] arg=5 handler=2 (datetime)
16561656
SET SESSION debug_dbug="-d,Predicant_to_list_comparator";
16571657
SET SESSION debug_dbug="-d,Item_func_in";

mysql-test/suite/compat/oracle/r/func_decode.result

Lines changed: 145 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,150 @@ EXPLAIN EXTENDED SELECT DECODE(12,10,'x10',11,'x11','def');
2828
id select_type table type possible_keys key key_len ref rows filtered Extra
2929
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
3030
Warnings:
31-
Note 1003 select case 12 when 10 then 'x10' when 11 then 'x11' else 'def' end AS "DECODE(12,10,'x10',11,'x11','def')"
31+
Note 1003 select decode_oracle(12,10,'x10',11,'x11','def') AS "DECODE(12,10,'x10',11,'x11','def')"
3232
CREATE TABLE decode (decode int);
3333
DROP TABLE decode;
34+
#
35+
# MDEV-13863 sql_mode=ORACLE: DECODE does not treat two NULLs as equivalent
36+
#
37+
SELECT DECODE(10);
38+
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1
39+
SELECT DECODE(10,10);
40+
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1
41+
SELECT DECODE_ORACLE(10);
42+
ERROR 42000: Incorrect parameter count in the call to native function 'DECODE_ORACLE'
43+
SELECT DECODE_ORACLE(10,10);
44+
ERROR 42000: Incorrect parameter count in the call to native function 'DECODE_ORACLE'
45+
EXPLAIN EXTENDED SELECT DECODE(12,10,'x10',11,'x11');
46+
id select_type table type possible_keys key key_len ref rows filtered Extra
47+
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
48+
Warnings:
49+
Note 1003 select decode_oracle(12,10,'x10',11,'x11') AS "DECODE(12,10,'x10',11,'x11')"
50+
EXPLAIN EXTENDED SELECT DECODE(12,10,'x10',11,'x11','def');
51+
id select_type table type possible_keys key key_len ref rows filtered Extra
52+
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
53+
Warnings:
54+
Note 1003 select decode_oracle(12,10,'x10',11,'x11','def') AS "DECODE(12,10,'x10',11,'x11','def')"
55+
EXPLAIN EXTENDED SELECT DECODE_ORACLE(12,10,'x10',11,'x11');
56+
id select_type table type possible_keys key key_len ref rows filtered Extra
57+
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
58+
Warnings:
59+
Note 1003 select decode_oracle(12,10,'x10',11,'x11') AS "DECODE_ORACLE(12,10,'x10',11,'x11')"
60+
EXPLAIN EXTENDED SELECT DECODE_ORACLE(12,10,'x10',11,'x11','def');
61+
id select_type table type possible_keys key key_len ref rows filtered Extra
62+
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
63+
Warnings:
64+
Note 1003 select decode_oracle(12,10,'x10',11,'x11','def') AS "DECODE_ORACLE(12,10,'x10',11,'x11','def')"
65+
CREATE TABLE t1 (a INT);
66+
CREATE VIEW v1 AS
67+
SELECT
68+
DECODE(a,1,'x1',NULL,'xNULL') AS d1,
69+
DECODE(a,1,'x1',NULL,'xNULL','xELSE') AS d2,
70+
DECODE_ORACLE(a,1,'x1',NULL,'xNULL') AS d3,
71+
DECODE_ORACLE(a,1,'x1',NULL,'xNULL','xELSE') AS d4
72+
FROM t1;
73+
SHOW CREATE VIEW v1;
74+
View Create View character_set_client collation_connection
75+
v1 CREATE VIEW "v1" AS select decode_oracle("t1"."a",1,'x1',NULL,'xNULL') AS "d1",decode_oracle("t1"."a",1,'x1',NULL,'xNULL','xELSE') AS "d2",decode_oracle("t1"."a",1,'x1',NULL,'xNULL') AS "d3",decode_oracle("t1"."a",1,'x1',NULL,'xNULL','xELSE') AS "d4" from "t1" latin1 latin1_swedish_ci
76+
DROP VIEW v1;
77+
DROP TABLE t1;
78+
SELECT DECODE(TIME'10:20:31','10:20:31','then1','10:20:32','then2','def');
79+
DECODE(TIME'10:20:31','10:20:31','then1','10:20:32','then2','def')
80+
then1
81+
SELECT DECODE(TIME'10:20:32','10:20:31','then1','10:20:32','then2','def');
82+
DECODE(TIME'10:20:32','10:20:31','then1','10:20:32','then2','def')
83+
then2
84+
SELECT DECODE(TIME'10:20:33','10:20:31','then1',NULL,'then2NULL','10:20:33','then3','def');
85+
DECODE(TIME'10:20:33','10:20:31','then1',NULL,'then2NULL','10:20:33','then3','def')
86+
then3
87+
SELECT DECODE(NULL,TIME'10:20:31','then1',NULL,'then2NULL','10:20:33','then3','def');
88+
DECODE(NULL,TIME'10:20:31','then1',NULL,'then2NULL','10:20:33','then3','def')
89+
then2NULL
90+
SELECT DECODE(TIMESTAMP'2001-01-01 10:20:31','2001-01-01 10:20:31','then1','2001-01-01 10:20:32','then2','def');
91+
DECODE(TIMESTAMP'2001-01-01 10:20:31','2001-01-01 10:20:31','then1','2001-01-01 10:20:32','then2','def')
92+
then1
93+
SELECT DECODE(TIMESTAMP'2001-01-01 10:20:32','2001-01-01 10:20:31','then1','2001-01-01 10:20:32','then2','def');
94+
DECODE(TIMESTAMP'2001-01-01 10:20:32','2001-01-01 10:20:31','then1','2001-01-01 10:20:32','then2','def')
95+
then2
96+
SELECT DECODE(TIMESTAMP'2001-01-01 10:20:33','2001-01-01 10:20:31','then1',NULL,'then2NULL','2001-01-01 10:20:33','then3','def');
97+
DECODE(TIMESTAMP'2001-01-01 10:20:33','2001-01-01 10:20:31','then1',NULL,'then2NULL','2001-01-01 10:20:33','then3','def')
98+
then3
99+
SELECT DECODE(NULL,TIMESTAMP'2001-01-01 10:20:31','then1',NULL,'then2NULL','2001-01-01 10:20:33','then3','def');
100+
DECODE(NULL,TIMESTAMP'2001-01-01 10:20:31','then1',NULL,'then2NULL','2001-01-01 10:20:33','then3','def')
101+
then2NULL
102+
SELECT DECODE('w1','w1','then1','w2','then2','def');
103+
DECODE('w1','w1','then1','w2','then2','def')
104+
then1
105+
SELECT DECODE('w2','w1','then1','w2','then2','def');
106+
DECODE('w2','w1','then1','w2','then2','def')
107+
then2
108+
SELECT DECODE('w3','w1','then1',NULL,'then2NULL','w3','then3','def');
109+
DECODE('w3','w1','then1',NULL,'then2NULL','w3','then3','def')
110+
then3
111+
SELECT DECODE(NULL,'w1','then1',NULL,'then2NULL','w3','then3','def');
112+
DECODE(NULL,'w1','then1',NULL,'then2NULL','w3','then3','def')
113+
then2NULL
114+
SELECT DECODE(1,1,'then1',2,'then2','def');
115+
DECODE(1,1,'then1',2,'then2','def')
116+
then1
117+
SELECT DECODE(2,1,'then1',2,'then2','def');
118+
DECODE(2,1,'then1',2,'then2','def')
119+
then2
120+
SELECT DECODE(3,1,'then1',NULL,'then2NULL',3,'then3','def');
121+
DECODE(3,1,'then1',NULL,'then2NULL',3,'then3','def')
122+
then3
123+
SELECT DECODE(NULL,1,'then1',NULL,'then2NULL',3,'then3','def');
124+
DECODE(NULL,1,'then1',NULL,'then2NULL',3,'then3','def')
125+
then2NULL
126+
SELECT DECODE(CAST(NULL AS SIGNED),1,'then1',NULL,'then2NULL',3,'then3','def');
127+
DECODE(CAST(NULL AS SIGNED),1,'then1',NULL,'then2NULL',3,'then3','def')
128+
then2NULL
129+
SELECT DECODE(1.0,1.0,'then1',2.0,'then2','def');
130+
DECODE(1.0,1.0,'then1',2.0,'then2','def')
131+
then1
132+
SELECT DECODE(2.0,1.0,'then1',2.0,'then2','def');
133+
DECODE(2.0,1.0,'then1',2.0,'then2','def')
134+
then2
135+
SELECT DECODE(3.0,1.0,'then1',NULL,'then2NULL',3.0,'then3','def');
136+
DECODE(3.0,1.0,'then1',NULL,'then2NULL',3.0,'then3','def')
137+
then3
138+
SELECT DECODE(NULL,1.0,'then1',NULL,'then2NULL',3.0,'then3','def');
139+
DECODE(NULL,1.0,'then1',NULL,'then2NULL',3.0,'then3','def')
140+
then2NULL
141+
SELECT DECODE(CAST(NULL AS DECIMAL),1.0,'then1',NULL,'then2NULL',3.0,'then3','def');
142+
DECODE(CAST(NULL AS DECIMAL),1.0,'then1',NULL,'then2NULL',3.0,'then3','def')
143+
then2NULL
144+
SELECT DECODE(1e0,1e0,'then1',2e0,'then2','def');
145+
DECODE(1e0,1e0,'then1',2e0,'then2','def')
146+
then1
147+
SELECT DECODE(2e0,1e0,'then1',2e0,'then2','def');
148+
DECODE(2e0,1e0,'then1',2e0,'then2','def')
149+
then2
150+
SELECT DECODE(3e0,1e0,'then1',NULL,'then2NULL',3e0,'then3','def');
151+
DECODE(3e0,1e0,'then1',NULL,'then2NULL',3e0,'then3','def')
152+
then3
153+
SELECT DECODE(NULL,1e0,'then1',NULL,'then2NULL',3e0,'then3','def');
154+
DECODE(NULL,1e0,'then1',NULL,'then2NULL',3e0,'then3','def')
155+
then2NULL
156+
SELECT DECODE(CAST(NULL AS DOUBLE),1e0,'then1',NULL,'then2NULL',3e0,'then3','def');
157+
DECODE(CAST(NULL AS DOUBLE),1e0,'then1',NULL,'then2NULL',3e0,'then3','def')
158+
then2NULL
159+
SELECT DECODE(NULL,NULL,1,2) FROM DUAL;
160+
DECODE(NULL,NULL,1,2)
161+
1
162+
SELECT DECODE(NULL,10,10,NULL,1,2) FROM DUAL;
163+
DECODE(NULL,10,10,NULL,1,2)
164+
1
165+
SELECT DECODE_ORACLE(NULL,NULL,1,2) FROM DUAL;
166+
DECODE_ORACLE(NULL,NULL,1,2)
167+
1
168+
SELECT DECODE_ORACLE(NULL,10,10,NULL,1,2) FROM DUAL;
169+
DECODE_ORACLE(NULL,10,10,NULL,1,2)
170+
1
171+
CREATE OR REPLACE TABLE t1 (a VARCHAR(10) DEFAULT NULL);
172+
INSERT INTO t1 VALUES (NULL),(1);
173+
SELECT a, DECODE(a,NULL,1,2) FROM t1;
174+
a DECODE(a,NULL,1,2)
175+
NULL 1
176+
1 2
177+
DROP TABLE t1;

mysql-test/suite/compat/oracle/t/func_decode.test

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,80 @@ EXPLAIN EXTENDED SELECT DECODE(12,10,'x10',11,'x11','def');
1919

2020
CREATE TABLE decode (decode int);
2121
DROP TABLE decode;
22+
23+
24+
--echo #
25+
--echo # MDEV-13863 sql_mode=ORACLE: DECODE does not treat two NULLs as equivalent
26+
--echo #
27+
28+
--error ER_PARSE_ERROR
29+
SELECT DECODE(10);
30+
--error ER_PARSE_ERROR
31+
SELECT DECODE(10,10);
32+
33+
--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
34+
SELECT DECODE_ORACLE(10);
35+
--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
36+
SELECT DECODE_ORACLE(10,10);
37+
38+
39+
EXPLAIN EXTENDED SELECT DECODE(12,10,'x10',11,'x11');
40+
EXPLAIN EXTENDED SELECT DECODE(12,10,'x10',11,'x11','def');
41+
EXPLAIN EXTENDED SELECT DECODE_ORACLE(12,10,'x10',11,'x11');
42+
EXPLAIN EXTENDED SELECT DECODE_ORACLE(12,10,'x10',11,'x11','def');
43+
44+
CREATE TABLE t1 (a INT);
45+
CREATE VIEW v1 AS
46+
SELECT
47+
DECODE(a,1,'x1',NULL,'xNULL') AS d1,
48+
DECODE(a,1,'x1',NULL,'xNULL','xELSE') AS d2,
49+
DECODE_ORACLE(a,1,'x1',NULL,'xNULL') AS d3,
50+
DECODE_ORACLE(a,1,'x1',NULL,'xNULL','xELSE') AS d4
51+
FROM t1;
52+
SHOW CREATE VIEW v1;
53+
DROP VIEW v1;
54+
DROP TABLE t1;
55+
56+
SELECT DECODE(TIME'10:20:31','10:20:31','then1','10:20:32','then2','def');
57+
SELECT DECODE(TIME'10:20:32','10:20:31','then1','10:20:32','then2','def');
58+
SELECT DECODE(TIME'10:20:33','10:20:31','then1',NULL,'then2NULL','10:20:33','then3','def');
59+
SELECT DECODE(NULL,TIME'10:20:31','then1',NULL,'then2NULL','10:20:33','then3','def');
60+
61+
SELECT DECODE(TIMESTAMP'2001-01-01 10:20:31','2001-01-01 10:20:31','then1','2001-01-01 10:20:32','then2','def');
62+
SELECT DECODE(TIMESTAMP'2001-01-01 10:20:32','2001-01-01 10:20:31','then1','2001-01-01 10:20:32','then2','def');
63+
SELECT DECODE(TIMESTAMP'2001-01-01 10:20:33','2001-01-01 10:20:31','then1',NULL,'then2NULL','2001-01-01 10:20:33','then3','def');
64+
SELECT DECODE(NULL,TIMESTAMP'2001-01-01 10:20:31','then1',NULL,'then2NULL','2001-01-01 10:20:33','then3','def');
65+
66+
SELECT DECODE('w1','w1','then1','w2','then2','def');
67+
SELECT DECODE('w2','w1','then1','w2','then2','def');
68+
SELECT DECODE('w3','w1','then1',NULL,'then2NULL','w3','then3','def');
69+
SELECT DECODE(NULL,'w1','then1',NULL,'then2NULL','w3','then3','def');
70+
71+
SELECT DECODE(1,1,'then1',2,'then2','def');
72+
SELECT DECODE(2,1,'then1',2,'then2','def');
73+
SELECT DECODE(3,1,'then1',NULL,'then2NULL',3,'then3','def');
74+
SELECT DECODE(NULL,1,'then1',NULL,'then2NULL',3,'then3','def');
75+
SELECT DECODE(CAST(NULL AS SIGNED),1,'then1',NULL,'then2NULL',3,'then3','def');
76+
77+
SELECT DECODE(1.0,1.0,'then1',2.0,'then2','def');
78+
SELECT DECODE(2.0,1.0,'then1',2.0,'then2','def');
79+
SELECT DECODE(3.0,1.0,'then1',NULL,'then2NULL',3.0,'then3','def');
80+
SELECT DECODE(NULL,1.0,'then1',NULL,'then2NULL',3.0,'then3','def');
81+
SELECT DECODE(CAST(NULL AS DECIMAL),1.0,'then1',NULL,'then2NULL',3.0,'then3','def');
82+
83+
SELECT DECODE(1e0,1e0,'then1',2e0,'then2','def');
84+
SELECT DECODE(2e0,1e0,'then1',2e0,'then2','def');
85+
SELECT DECODE(3e0,1e0,'then1',NULL,'then2NULL',3e0,'then3','def');
86+
SELECT DECODE(NULL,1e0,'then1',NULL,'then2NULL',3e0,'then3','def');
87+
SELECT DECODE(CAST(NULL AS DOUBLE),1e0,'then1',NULL,'then2NULL',3e0,'then3','def');
88+
89+
SELECT DECODE(NULL,NULL,1,2) FROM DUAL;
90+
SELECT DECODE(NULL,10,10,NULL,1,2) FROM DUAL;
91+
92+
SELECT DECODE_ORACLE(NULL,NULL,1,2) FROM DUAL;
93+
SELECT DECODE_ORACLE(NULL,10,10,NULL,1,2) FROM DUAL;
94+
95+
CREATE OR REPLACE TABLE t1 (a VARCHAR(10) DEFAULT NULL);
96+
INSERT INTO t1 VALUES (NULL),(1);
97+
SELECT a, DECODE(a,NULL,1,2) FROM t1;
98+
DROP TABLE t1;

mysql-test/suite/sys_vars/inc/sysvars_server.inc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ select * from information_schema.system_variables
3030
'rand_seed2',
3131
'system_time_zone',
3232
'version_comment',
33+
'version_source_revision',
3334
'version_compile_machine', 'version_compile_os',
3435
'version_malloc_library', 'version_ssl_library', 'version'
3536
)
@@ -53,6 +54,7 @@ select VARIABLE_NAME, VARIABLE_SCOPE, VARIABLE_TYPE, VARIABLE_COMMENT,
5354
'rand_seed2',
5455
'system_time_zone',
5556
'version_comment',
57+
'version_source_revision',
5658
'version_compile_machine', 'version_compile_os',
5759
'version_malloc_library', 'version_ssl_library', 'version'
5860
)

0 commit comments

Comments
 (0)