Skip to content

Commit

Permalink
MDEV-32503 Queries from I_S.KEY_PERIOD_USAGE do not obey case-sensiti…
Browse files Browse the repository at this point in the history
…vity

Set the correct values for idx_field1, idx_field2 (i.e. db and table name
fields) of ST_SCHEMA_TABLE instance.
  • Loading branch information
FooBarrior authored and sanja-byelkin committed Feb 12, 2024
1 parent 261993f commit 5c2f8c0
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 1 deletion.
20 changes: 20 additions & 0 deletions mysql-test/suite/period/r/i_s_notembedded,win.rdiff
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--- suite/period/r/i_s_notembedded.result 2024-01-01 19:50:37.000000000 +0100
+++ suite/period/r/i_s_notembedded,win.reject 2024-01-01 19:57:18.888306500 +0100
@@ -69,13 +69,17 @@
set names latin1 collate latin1_general_cs;
select table_name from information_schema.periods where table_schema = 'TEST';
table_name
+t
select table_name from information_schema.key_period_usage where table_schema = 'TEST';
table_name
+t
set names latin1 collate latin1_general_ci;
select table_name from information_schema.periods where table_schema = 'TEST';
table_name
+t
select table_name from information_schema.key_period_usage where table_schema = 'TEST';
table_name
+t
# [DUPLICATE] MDEV-32504 Search by I_S.KEY_PERIOD_USAGE.CONSTRAINT_NAME
# does not work
select constraint_name from information_schema.key_period_usage where table_name = 't';
22 changes: 22 additions & 0 deletions mysql-test/suite/period/r/i_s_notembedded.result
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,25 @@ def test t2 mytime s e
connection default;
drop user periods_hidden@localhost;
drop tables t1, t2;
# MDEV-32503 Queries from KEY_PERIOD_USAGE don't obey case-sensitivity
create table t (a int, b date, c date, period for app(b,c),
unique idx(a, app without overlaps));
set names latin1 collate latin1_general_cs;
select table_name from information_schema.periods where table_schema = 'TEST';
table_name
select table_name from information_schema.key_period_usage where table_schema = 'TEST';
table_name
set names latin1 collate latin1_general_ci;
select table_name from information_schema.periods where table_schema = 'TEST';
table_name
select table_name from information_schema.key_period_usage where table_schema = 'TEST';
table_name
# [DUPLICATE] MDEV-32504 Search by I_S.KEY_PERIOD_USAGE.CONSTRAINT_NAME
# does not work
select constraint_name from information_schema.key_period_usage where table_name = 't';
constraint_name
idx
select constraint_name from information_schema.key_period_usage where constraint_name = 'idx';
constraint_name
idx
drop table t;
25 changes: 25 additions & 0 deletions mysql-test/suite/period/t/i_s_notembedded.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
--source include/not_embedded.inc
--source include/platform.inc

select * from information_schema.periods;

Expand Down Expand Up @@ -47,3 +48,27 @@ select * from information_schema.periods where table_schema = 'test';
--connection default
drop user periods_hidden@localhost;
drop tables t1, t2;

--echo # MDEV-32503 Queries from KEY_PERIOD_USAGE don't obey case-sensitivity

create table t (a int, b date, c date, period for app(b,c),
unique idx(a, app without overlaps));


set names latin1 collate latin1_general_cs;

select table_name from information_schema.periods where table_schema = 'TEST';
select table_name from information_schema.key_period_usage where table_schema = 'TEST';
set names latin1 collate latin1_general_ci;

select table_name from information_schema.periods where table_schema = 'TEST';
select table_name from information_schema.key_period_usage where table_schema = 'TEST';

--echo # [DUPLICATE] MDEV-32504 Search by I_S.KEY_PERIOD_USAGE.CONSTRAINT_NAME
--echo # does not work
disable_warnings; # storage engine 'Innodb' is not found
select constraint_name from information_schema.key_period_usage where table_name = 't';
select constraint_name from information_schema.key_period_usage where constraint_name = 'idx';
enable_warnings;

drop table t;
2 changes: 1 addition & 1 deletion sql/sql_show.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10360,7 +10360,7 @@ ST_SCHEMA_TABLE schema_tables[]=
get_all_tables, 0, get_schema_key_column_usage_record, 4, 5, 0,
OPTIMIZE_I_S_TABLE|OPEN_TABLE_ONLY},
{"KEY_PERIOD_USAGE", Show::key_period_usage_fields_info, 0,
get_all_tables, 0, get_schema_key_period_usage_record, 1, 2, 0,
get_all_tables, 0, get_schema_key_period_usage_record, 4, 5, 0,
OPTIMIZE_I_S_TABLE | OPEN_FRM_FILE_ONLY},
{"OPEN_TABLES", Show::open_tables_fields_info, 0,
fill_open_tables, make_old_format, 0, -1, -1, 1, 0},
Expand Down

0 comments on commit 5c2f8c0

Please sign in to comment.