Skip to content

Commit 310fd6f

Browse files
committed
Backporting bugs fixes fixed by MDEV-31340 from 11.5
The patch for MDEV-31340 fixed the following bugs: MDEV-33084 LASTVAL(t1) and LASTVAL(T1) do not work well with lower-case-table-names=0 MDEV-33085 Tables T1 and t1 do not work well with ENGINE=CSV and lower-case-table-names=0 MDEV-33086 SHOW OPEN TABLES IN DB1 -- is case insensitive with lower-case-table-names=0 MDEV-33088 Cannot create triggers in the database `MYSQL` MDEV-33103 LOCK TABLE t1 AS t2 -- alias is not case sensitive with lower-case-table-names=0 MDEV-33108 TABLE_STATISTICS and INDEX_STATISTICS are case insensitive with lower-case-table-names=0 MDEV-33109 DROP DATABASE MYSQL -- does not drop SP with lower-case-table-names=0 MDEV-33110 HANDLER commands are case insensitive with lower-case-table-names=0 MDEV-33119 User is case insensitive in INFORMATION_SCHEMA.VIEWS MDEV-33120 System log table names are case insensitive with lower-cast-table-names=0 Backporting the fixes from 11.5 to 10.5
1 parent b2944ad commit 310fd6f

23 files changed

+561
-90
lines changed

mysql-test/main/lowercase_table5.result

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,145 @@ DROP PROCEDURE SP;
4747
#
4848
# End of 10.4 tests
4949
#
50+
#
51+
# Start of 10.5 tests
52+
#
53+
#
54+
# MDEV-33084 LASTVAL(t1) and LASTVAL(T1) do not work well with lower-case-table-names=0
55+
#
56+
CREATE SEQUENCE t1;
57+
CREATE SEQUENCE T1;
58+
SELECT nextval(t1), lastval(t1);
59+
nextval(t1) lastval(t1)
60+
1 1
61+
SELECT nextval(T1), lastval(T1);
62+
nextval(T1) lastval(T1)
63+
1 1
64+
SELECT lastval(t1), lastval(T1) l2;
65+
lastval(t1) l2
66+
1 1
67+
DROP SEQUENCE t1, T1;
68+
#
69+
# MDEV-33086 SHOW OPEN TABLES IN DB1 -- is case insensitive with lower-case-table-names=0
70+
#
71+
CREATE DATABASE db1;
72+
CREATE TABLE db1.t1 (a INT);
73+
SELECT * FROM db1.t1;
74+
a
75+
SHOW OPEN TABLES IN DB1;
76+
Database Table In_use Name_locked
77+
SHOW OPEN TABLES IN db1;
78+
Database Table In_use Name_locked
79+
db1 t1 0 0
80+
DROP DATABASE db1;
81+
#
82+
# MDEV-33088 Cannot create triggers in the database `MYSQL`
83+
#
84+
CREATE DATABASE MYSQL;
85+
CREATE TABLE MYSQL.t1 (a INT);
86+
CREATE TABLE MYSQL.t2 (a INT);
87+
CREATE TRIGGER MYSQL.tr1 AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES (new.a);
88+
INSERT INTO MYSQL.t1 VALUES (10);
89+
SELECT * FROM MYSQL.t1;
90+
a
91+
10
92+
SELECT * FROM MYSQL.t2;
93+
a
94+
10
95+
DROP DATABASE MYSQL;
96+
#
97+
# MDEV-33103 LOCK TABLE t1 AS t2 -- alias is not case sensitive with lower-case-table-names=0
98+
#
99+
CREATE TABLE t1 (a INT);
100+
INSERT INTO t1 VALUES (1);
101+
LOCK TABLE t1 AS t2 READ;
102+
SELECT * FROM t1 AS t2;
103+
a
104+
1
105+
UNLOCK TABLES;
106+
LOCK TABLE t1 AS t2 READ;
107+
SELECT * FROM t1 AS T2;
108+
ERROR HY000: Table 'T2' was not locked with LOCK TABLES
109+
UNLOCK TABLES;
110+
DROP TABLE t1;
111+
#
112+
# MDEV-33108 TABLE_STATISTICS and INDEX_STATISTICS are case insensitive with lower-case-table-names=0
113+
#
114+
SET GLOBAL userstat=1;
115+
CREATE TABLE t1 (a INT, KEY(a));
116+
INSERT INTO t1 VALUES (1),(2),(3),(4);
117+
SELECT * FROM t1 ORDER BY a;
118+
a
119+
1
120+
2
121+
3
122+
4
123+
CREATE TABLE T1 (a INT, KEY(a));
124+
INSERT INTO T1 VALUES (1),(2),(3),(4);
125+
SELECT * FROM T1 ORDER BY a;
126+
a
127+
1
128+
2
129+
3
130+
4
131+
SELECT * FROM INFORMATION_SCHEMA.TABLE_STATISTICS ORDER BY BINARY TABLE_NAME;
132+
TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES
133+
test T1 4 4 4
134+
test t1 4 4 4
135+
SELECT * FROM INFORMATION_SCHEMA.INDEX_STATISTICS ORDER BY BINARY TABLE_NAME;
136+
TABLE_SCHEMA TABLE_NAME INDEX_NAME ROWS_READ
137+
test T1 a 4
138+
test t1 a 4
139+
DROP TABLE t1;
140+
DROP TABLE T1;
141+
SET GLOBAL userstat=DEFAULT;
142+
#
143+
# MDEV-33109 DROP DATABASE MYSQL -- does not drop SP with lower-case-table-names=0
144+
#
145+
CREATE DATABASE MYSQL;
146+
CREATE FUNCTION MYSQL.f1() RETURNS INT RETURN 1;
147+
DROP DATABASE MYSQL;
148+
SELECT db, name, body FROM mysql.proc WHERE db=BINARY 'MYSQL' AND name='f1';
149+
db name body
150+
#
151+
# MDEV-33110 HANDLER commands are case insensitive with lower-case-table-names=0
152+
#
153+
CREATE TABLE t1 (a INT);
154+
INSERT INTO t1 VALUES (1),(2);
155+
HANDLER t1 OPEN;
156+
HANDLER t1 READ FIRST;
157+
a
158+
1
159+
CREATE OR REPLACE TABLE T1 (a INT);
160+
DROP TABLE T1;
161+
HANDLER t1 READ NEXT;
162+
a
163+
2
164+
HANDLER t1 CLOSE;
165+
DROP TABLE t1;
166+
#
167+
# MDEV-33120 System log table names are case insensitive with lower-cast-table-names=0
168+
#
169+
CREATE TABLE mysql.GENERAL_log (a INT);
170+
INSERT INTO mysql.GENERAL_log VALUES (1),(2);
171+
DROP TABLE mysql.GENERAL_log;
172+
CREATE TABLE mysql.SLOW_log (a INT);
173+
INSERT INTO mysql.SLOW_log VALUES (1),(2);
174+
DROP TABLE mysql.SLOW_log;
175+
CREATE TABLE mysql.TRANSACTION_registry (a INT);
176+
INSERT INTO mysql.TRANSACTION_registry VALUES (1),(2);
177+
DROP TABLE mysql.TRANSACTION_registry;
178+
CREATE DATABASE MYSQL;
179+
CREATE TABLE MYSQL.general_log (a INT);
180+
INSERT INTO MYSQL.general_log VALUES (1),(2);
181+
DROP TABLE MYSQL.general_log;
182+
CREATE TABLE MYSQL.slow_log (a INT);
183+
INSERT INTO MYSQL.slow_log VALUES (1),(2);
184+
DROP TABLE MYSQL.slow_log;
185+
CREATE TABLE MYSQL.transaction_registry (a INT);
186+
INSERT INTO MYSQL.transaction_registry VALUES (1),(2);
187+
DROP TABLE MYSQL.transaction_registry;
188+
DROP DATABASE MYSQL;
189+
#
190+
# End of 10.5 tests
191+
#

mysql-test/main/lowercase_table5.test

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,141 @@ DROP PROCEDURE SP;
4949
--echo #
5050
--echo # End of 10.4 tests
5151
--echo #
52+
53+
--echo #
54+
--echo # Start of 10.5 tests
55+
--echo #
56+
57+
--echo #
58+
--echo # MDEV-33084 LASTVAL(t1) and LASTVAL(T1) do not work well with lower-case-table-names=0
59+
--echo #
60+
61+
CREATE SEQUENCE t1;
62+
CREATE SEQUENCE T1;
63+
--disable_ps2_protocol
64+
SELECT nextval(t1), lastval(t1);
65+
SELECT nextval(T1), lastval(T1);
66+
SELECT lastval(t1), lastval(T1) l2;
67+
--enable_ps2_protocol
68+
DROP SEQUENCE t1, T1;
69+
70+
--echo #
71+
--echo # MDEV-33086 SHOW OPEN TABLES IN DB1 -- is case insensitive with lower-case-table-names=0
72+
--echo #
73+
74+
CREATE DATABASE db1;
75+
CREATE TABLE db1.t1 (a INT);
76+
SELECT * FROM db1.t1;
77+
SHOW OPEN TABLES IN DB1;
78+
SHOW OPEN TABLES IN db1;
79+
DROP DATABASE db1;
80+
81+
--echo #
82+
--echo # MDEV-33088 Cannot create triggers in the database `MYSQL`
83+
--echo #
84+
85+
CREATE DATABASE MYSQL;
86+
CREATE TABLE MYSQL.t1 (a INT);
87+
CREATE TABLE MYSQL.t2 (a INT);
88+
CREATE TRIGGER MYSQL.tr1 AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES (new.a);
89+
INSERT INTO MYSQL.t1 VALUES (10);
90+
SELECT * FROM MYSQL.t1;
91+
SELECT * FROM MYSQL.t2;
92+
DROP DATABASE MYSQL;
93+
94+
95+
--echo #
96+
--echo # MDEV-33103 LOCK TABLE t1 AS t2 -- alias is not case sensitive with lower-case-table-names=0
97+
--echo #
98+
99+
--disable_view_protocol
100+
CREATE TABLE t1 (a INT);
101+
INSERT INTO t1 VALUES (1);
102+
LOCK TABLE t1 AS t2 READ;
103+
SELECT * FROM t1 AS t2;
104+
UNLOCK TABLES;
105+
LOCK TABLE t1 AS t2 READ;
106+
--error ER_TABLE_NOT_LOCKED
107+
SELECT * FROM t1 AS T2;
108+
UNLOCK TABLES;
109+
DROP TABLE t1;
110+
--enable_view_protocol
111+
112+
113+
--echo #
114+
--echo # MDEV-33108 TABLE_STATISTICS and INDEX_STATISTICS are case insensitive with lower-case-table-names=0
115+
--echo #
116+
117+
SET GLOBAL userstat=1;
118+
CREATE TABLE t1 (a INT, KEY(a));
119+
INSERT INTO t1 VALUES (1),(2),(3),(4);
120+
--disable_ps2_protocol
121+
SELECT * FROM t1 ORDER BY a;
122+
CREATE TABLE T1 (a INT, KEY(a));
123+
INSERT INTO T1 VALUES (1),(2),(3),(4);
124+
SELECT * FROM T1 ORDER BY a;
125+
--enable_ps2_protocol
126+
SELECT * FROM INFORMATION_SCHEMA.TABLE_STATISTICS ORDER BY BINARY TABLE_NAME;
127+
SELECT * FROM INFORMATION_SCHEMA.INDEX_STATISTICS ORDER BY BINARY TABLE_NAME;
128+
DROP TABLE t1;
129+
DROP TABLE T1;
130+
SET GLOBAL userstat=DEFAULT;
131+
132+
133+
--echo #
134+
--echo # MDEV-33109 DROP DATABASE MYSQL -- does not drop SP with lower-case-table-names=0
135+
--echo #
136+
137+
CREATE DATABASE MYSQL;
138+
CREATE FUNCTION MYSQL.f1() RETURNS INT RETURN 1;
139+
DROP DATABASE MYSQL;
140+
SELECT db, name, body FROM mysql.proc WHERE db=BINARY 'MYSQL' AND name='f1';
141+
142+
143+
--echo #
144+
--echo # MDEV-33110 HANDLER commands are case insensitive with lower-case-table-names=0
145+
--echo #
146+
147+
CREATE TABLE t1 (a INT);
148+
INSERT INTO t1 VALUES (1),(2);
149+
HANDLER t1 OPEN;
150+
HANDLER t1 READ FIRST;
151+
CREATE OR REPLACE TABLE T1 (a INT);
152+
DROP TABLE T1;
153+
HANDLER t1 READ NEXT;
154+
HANDLER t1 CLOSE;
155+
DROP TABLE t1;
156+
157+
--echo #
158+
--echo # MDEV-33120 System log table names are case insensitive with lower-cast-table-names=0
159+
--echo #
160+
161+
CREATE TABLE mysql.GENERAL_log (a INT);
162+
INSERT INTO mysql.GENERAL_log VALUES (1),(2);
163+
DROP TABLE mysql.GENERAL_log;
164+
165+
CREATE TABLE mysql.SLOW_log (a INT);
166+
INSERT INTO mysql.SLOW_log VALUES (1),(2);
167+
DROP TABLE mysql.SLOW_log;
168+
169+
CREATE TABLE mysql.TRANSACTION_registry (a INT);
170+
INSERT INTO mysql.TRANSACTION_registry VALUES (1),(2);
171+
DROP TABLE mysql.TRANSACTION_registry;
172+
173+
CREATE DATABASE MYSQL;
174+
CREATE TABLE MYSQL.general_log (a INT);
175+
INSERT INTO MYSQL.general_log VALUES (1),(2);
176+
DROP TABLE MYSQL.general_log;
177+
178+
CREATE TABLE MYSQL.slow_log (a INT);
179+
INSERT INTO MYSQL.slow_log VALUES (1),(2);
180+
DROP TABLE MYSQL.slow_log;
181+
182+
CREATE TABLE MYSQL.transaction_registry (a INT);
183+
INSERT INTO MYSQL.transaction_registry VALUES (1),(2);
184+
DROP TABLE MYSQL.transaction_registry;
185+
DROP DATABASE MYSQL;
186+
187+
--echo #
188+
--echo # End of 10.5 tests
189+
--echo #

mysql-test/main/view_grant.result

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1954,3 +1954,34 @@ connection default;
19541954
drop user user_11766767;
19551955
drop database mysqltest1;
19561956
drop database mysqltest2;
1957+
#
1958+
# MDEV-33119 User is case insensitive in INFORMATION_SCHEMA.VIEWS
1959+
#
1960+
USE test;
1961+
CREATE USER foo;
1962+
CREATE USER FOO;
1963+
GRANT SELECT ON test.* TO foo;
1964+
GRANT SELECT ON test.* TO FOO;
1965+
CREATE DEFINER=foo SQL SECURITY INVOKER VIEW v1 AS SELECT 1 AS c1;
1966+
connect FOO, localhost, FOO, , test;
1967+
connection FOO;
1968+
SELECT CURRENT_USER;
1969+
CURRENT_USER
1970+
FOO@%
1971+
SELECT * FROM INFORMATION_SCHEMA.VIEWS;
1972+
TABLE_CATALOG def
1973+
TABLE_SCHEMA test
1974+
TABLE_NAME v1
1975+
VIEW_DEFINITION
1976+
CHECK_OPTION NONE
1977+
IS_UPDATABLE NO
1978+
DEFINER foo@%
1979+
SECURITY_TYPE INVOKER
1980+
CHARACTER_SET_CLIENT latin1
1981+
COLLATION_CONNECTION latin1_swedish_ci
1982+
ALGORITHM UNDEFINED
1983+
disconnect FOO;
1984+
connection default;
1985+
DROP VIEW v1;
1986+
DROP USER foo;
1987+
DROP USER FOO;

mysql-test/main/view_grant.test

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2207,3 +2207,30 @@ drop database mysqltest2;
22072207

22082208
# Wait till we reached the initial number of concurrent sessions
22092209
--source include/wait_until_count_sessions.inc
2210+
2211+
--echo #
2212+
--echo # MDEV-33119 User is case insensitive in INFORMATION_SCHEMA.VIEWS
2213+
--echo #
2214+
2215+
USE test;
2216+
CREATE USER foo;
2217+
CREATE USER FOO;
2218+
GRANT SELECT ON test.* TO foo;
2219+
GRANT SELECT ON test.* TO FOO;
2220+
2221+
CREATE DEFINER=foo SQL SECURITY INVOKER VIEW v1 AS SELECT 1 AS c1;
2222+
2223+
--connect (FOO, localhost, FOO, , test)
2224+
--connection FOO
2225+
2226+
SELECT CURRENT_USER;
2227+
--vertical_results
2228+
--query_vertical SELECT * FROM INFORMATION_SCHEMA.VIEWS
2229+
--horizontal_results
2230+
2231+
--disconnect FOO
2232+
--connection default
2233+
2234+
DROP VIEW v1;
2235+
DROP USER foo;
2236+
DROP USER FOO;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#
2+
# MDEV-33085 Tables T1 and t1 do not work well with ENGINE=CSV and lower-case-table-names=0
3+
#
4+
CREATE OR REPLACE TABLE t1 (a INT NOT NULL) ENGINE=CSV;
5+
CREATE OR REPLACE TABLE T1 (a INT NOT NULL) ENGINE=CSV;
6+
INSERT INTO t1 VALUES (10);
7+
INSERT INTO T1 VALUES (20);
8+
SELECT * FROM t1;
9+
a
10+
10
11+
SELECT * FROM T1;
12+
a
13+
20
14+
DROP TABLE t1;
15+
DROP TABLE T1;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--source include/have_csv.inc
2+
--source include/have_lowercase0.inc
3+
--source include/have_case_sensitive_file_system.inc
4+
5+
--echo #
6+
--echo # MDEV-33085 Tables T1 and t1 do not work well with ENGINE=CSV and lower-case-table-names=0
7+
--echo #
8+
9+
CREATE OR REPLACE TABLE t1 (a INT NOT NULL) ENGINE=CSV;
10+
CREATE OR REPLACE TABLE T1 (a INT NOT NULL) ENGINE=CSV;
11+
INSERT INTO t1 VALUES (10);
12+
INSERT INTO T1 VALUES (20);
13+
SELECT * FROM t1;
14+
SELECT * FROM T1;
15+
DROP TABLE t1;
16+
DROP TABLE T1;

0 commit comments

Comments
 (0)