Skip to content

Commit dbe3bd6

Browse files
marcalffbjornmu
authored andcommitted
Bug#20559828 SHOW GLOBAL VARIABLES WHERE NOT DEPRECATED IN EMBEDDED
Before this fix, the command: SHOW GLOBAL VARIABLE WHERE ... printed a deprecation warning, inviting to use the performance_schema tables instead. This warning was incorrect, and caused confusion for the embedded build. There are two separate changes that are independent: First, the syntax SHOW GLOBAL VARIABLE WHERE ... [LIKE ...] should be changed to simply SHOW GLOBAL VARIABLE [like ...] abandonning the WHERE clause syntax. This applies to all builds, including embedded. Secondly, the query SHOW GLOBAL VARIABLE [like ...] might be rewritten using the new performance_schema tables instead. This is optional, and only applies to builds that include the performance_schema (hence does not apply for the embedded build). The warning printed mixed the two changes. The deprecation only applies to the first part, dropping support for the WHERE clause in SHOW STATUS / SHOW VARIABLES. With this fix, the proper deprecation warning is now printed, and it is also printed for embedded builds. (cherry picked from commit 7323b2abfb98105f76336b81d1e010a0c0036c45)
1 parent ccb48b2 commit dbe3bd6

File tree

4 files changed

+45
-8
lines changed

4 files changed

+45
-8
lines changed

mysql-test/r/show_variables.result

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
SHOW GLOBAL VARIABLES WHERE Variable_name LIKE "abc";
2+
Variable_name Value
3+
Warnings:
4+
Warning 1287 'SHOW GLOBAL VARIABLES WHERE' is deprecated and will be removed in a future release. Please use SHOW GLOBAL VARIABLES [LIKE] instead
5+
SHOW GLOBAL VARIABLES LIKE "abc";
6+
Variable_name Value
7+
SHOW SESSION VARIABLES WHERE Variable_name LIKE "abc";
8+
Variable_name Value
9+
Warnings:
10+
Warning 1287 'SHOW SESSION VARIABLES WHERE' is deprecated and will be removed in a future release. Please use SHOW SESSION VARIABLES [LIKE] instead
11+
SHOW SESSION VARIABLES LIKE "abc";
12+
Variable_name Value
13+
SHOW VARIABLES WHERE Variable_name LIKE "abc";
14+
Variable_name Value
15+
Warnings:
16+
Warning 1287 'SHOW SESSION VARIABLES WHERE' is deprecated and will be removed in a future release. Please use SHOW SESSION VARIABLES [LIKE] instead
17+
SHOW VARIABLES LIKE "abc";
18+
Variable_name Value

mysql-test/suite/perfschema/r/show_coverage.result

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,22 @@ set global show_compatibility_56 = ON;
1111
SHOW GLOBAL STATUS WHERE VARIABLE_NAME LIKE "foo";
1212
Variable_name Value
1313
Warnings:
14-
Warning 1287 'SHOW GLOBAL STATUS WHERE' is deprecated and will be removed in a future release. Please use performance_schema.global_status instead
14+
Warning 1287 'SHOW GLOBAL STATUS WHERE' is deprecated and will be removed in a future release. Please use SHOW GLOBAL STATUS [LIKE] instead
1515

1616
SHOW SESSION STATUS WHERE VARIABLE_NAME LIKE "foo";
1717
Variable_name Value
1818
Warnings:
19-
Warning 1287 'SHOW SESSION STATUS WHERE' is deprecated and will be removed in a future release. Please use performance_schema.session_status instead
19+
Warning 1287 'SHOW SESSION STATUS WHERE' is deprecated and will be removed in a future release. Please use SHOW SESSION STATUS [LIKE] instead
2020

2121
SHOW GLOBAL VARIABLES WHERE VARIABLE_NAME LIKE "foo";
2222
Variable_name Value
2323
Warnings:
24-
Warning 1287 'SHOW GLOBAL VARIABLES WHERE' is deprecated and will be removed in a future release. Please use performance_schema.global_variables instead
24+
Warning 1287 'SHOW GLOBAL VARIABLES WHERE' is deprecated and will be removed in a future release. Please use SHOW GLOBAL VARIABLES [LIKE] instead
2525

2626
SHOW SESSION VARIABLES WHERE VARIABLE_NAME LIKE "foo";
2727
Variable_name Value
2828
Warnings:
29-
Warning 1287 'SHOW SESSION VARIABLES WHERE' is deprecated and will be removed in a future release. Please use performance_schema.session_variables instead
29+
Warning 1287 'SHOW SESSION VARIABLES WHERE' is deprecated and will be removed in a future release. Please use SHOW SESSION VARIABLES [LIKE] instead
3030

3131
# TEST 2
3232
# CREATE..SELECT -- Expect correct ERR_WARN_DEPRECATED_SYNTAX

mysql-test/t/show_variables.test

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
# Deprecation warning
3+
SHOW GLOBAL VARIABLES WHERE Variable_name LIKE "abc";
4+
5+
# No warnings
6+
SHOW GLOBAL VARIABLES LIKE "abc";
7+
8+
# Deprecation warning
9+
SHOW SESSION VARIABLES WHERE Variable_name LIKE "abc";
10+
11+
# No warnings
12+
SHOW SESSION VARIABLES LIKE "abc";
13+
14+
# Deprecation warning
15+
SHOW VARIABLES WHERE Variable_name LIKE "abc";
16+
17+
# No warnings
18+
SHOW VARIABLES LIKE "abc";
19+

sql/sql_show.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6918,12 +6918,12 @@ void push_show_where_warning(THD *thd, enum enum_var_type option_type, bool stat
69186918
if (option_type == OPT_GLOBAL)
69196919
{
69206920
old_name= (status ? "SHOW GLOBAL STATUS WHERE" : "SHOW GLOBAL VARIABLES WHERE");
6921-
new_name= (status ? "performance_schema.global_status" : "performance_schema.global_variables");
6921+
new_name= (status ? "SHOW GLOBAL STATUS [LIKE]" : "SHOW GLOBAL VARIABLES [LIKE]");
69226922
}
69236923
else
69246924
{
69256925
old_name= (status ? "SHOW SESSION STATUS WHERE" : "SHOW SESSION VARIABLES WHERE");
6926-
new_name= (status ? "performance_schema.session_status" : "performance_schema.session_variables");
6926+
new_name= (status ? "SHOW SESSION STATUS [LIKE]" : "SHOW SESSION VARIABLES [LIKE]");
69276927
}
69286928

69296929
push_warning_printf(thd, Sql_condition::SL_WARNING,
@@ -6960,7 +6960,6 @@ int fill_variables(THD *thd, TABLE_LIST *tables, Item *cond)
69606960
option_type= OPT_SESSION;
69616961
}
69626962

6963-
#ifndef EMBEDDED_LIBRARY
69646963
/* Issue deprecation warning. */
69656964
if (lex->sql_command == SQLCOM_SHOW_VARIABLES)
69666965
{
@@ -6969,6 +6968,7 @@ int fill_variables(THD *thd, TABLE_LIST *tables, Item *cond)
69696968
push_show_where_warning(thd, option_type, false);
69706969
}
69716970
}
6971+
#ifndef EMBEDDED_LIBRARY
69726972
else
69736973
{
69746974
push_select_warning(thd, option_type, false);
@@ -7028,7 +7028,6 @@ int fill_status(THD *thd, TABLE_LIST *tables, Item *cond)
70287028
tmp1= &thd->status_var;
70297029
}
70307030

7031-
#ifndef EMBEDDED_LIBRARY
70327031
/* Issue deprecation warning. */
70337032
if (lex->sql_command == SQLCOM_SHOW_STATUS)
70347033
{
@@ -7037,6 +7036,7 @@ int fill_status(THD *thd, TABLE_LIST *tables, Item *cond)
70377036
push_show_where_warning(thd, option_type, true);
70387037
}
70397038
}
7039+
#ifndef EMBEDDED_LIBRARY
70407040
else
70417041
{
70427042
push_select_warning(thd, option_type, true);

0 commit comments

Comments
 (0)