mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-34305 Redundant truncation errors/warnings with optimizer_trace enabled
my_like_range*() can create longer keys than Field::char_length(). This caused warnings during print_range(). Fix: Suppressing warnings in print_range().
This commit is contained in:
@ -9280,5 +9280,33 @@ select QUERY, LENGTH(trace)>1 from information_schema.optimizer_trace;
|
|||||||
QUERY LENGTH(trace)>1
|
QUERY LENGTH(trace)>1
|
||||||
insert into t2 select * from t1 where a<= b and a>4 1
|
insert into t2 select * from t1 where a<= b and a>4 1
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
|
#
|
||||||
|
# MDEV-34305 Redundant truncation errors/warnings with optimizer_trace enabled
|
||||||
|
#
|
||||||
|
SET @@optimizer_trace='enabled=on';
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
a CHAR(2) NOT NULL PRIMARY KEY,
|
||||||
|
b VARCHAR(20) NOT NULL,
|
||||||
|
KEY (b)
|
||||||
|
) CHARSET=utf8mb4;
|
||||||
|
CREATE TABLE t2 (
|
||||||
|
a CHAR(2) NOT NULL PRIMARY KEY,
|
||||||
|
b VARCHAR(20) NOT NULL,
|
||||||
|
KEY (b)
|
||||||
|
) CHARSET=utf8mb4;
|
||||||
|
INSERT INTO t1 VALUES
|
||||||
|
('AB','MySQLAB'),
|
||||||
|
('JA','Sun Microsystems'),
|
||||||
|
('MS','Microsoft'),
|
||||||
|
('IB','IBM- Inc.'),
|
||||||
|
('GO','Google Inc.');
|
||||||
|
INSERT IGNORE INTO t2 VALUES
|
||||||
|
('AB','Sweden'),
|
||||||
|
('JA','USA'),
|
||||||
|
('MS','United States'),
|
||||||
|
('IB','North America'),
|
||||||
|
('GO','South America');
|
||||||
|
UPDATE t1,t2 SET t1.b=UPPER(t1.b) WHERE t1.b LIKE 'Unknown%';
|
||||||
|
DROP TABLE t1, t2;
|
||||||
# End of 10.5 tests
|
# End of 10.5 tests
|
||||||
set optimizer_trace='enabled=off';
|
set optimizer_trace='enabled=off';
|
||||||
|
@ -971,5 +971,40 @@ select QUERY, LENGTH(trace)>1 from information_schema.optimizer_trace;
|
|||||||
|
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-34305 Redundant truncation errors/warnings with optimizer_trace enabled
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
SET @@optimizer_trace='enabled=on';
|
||||||
|
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
a CHAR(2) NOT NULL PRIMARY KEY,
|
||||||
|
b VARCHAR(20) NOT NULL,
|
||||||
|
KEY (b)
|
||||||
|
) CHARSET=utf8mb4;
|
||||||
|
|
||||||
|
CREATE TABLE t2 (
|
||||||
|
a CHAR(2) NOT NULL PRIMARY KEY,
|
||||||
|
b VARCHAR(20) NOT NULL,
|
||||||
|
KEY (b)
|
||||||
|
) CHARSET=utf8mb4;
|
||||||
|
|
||||||
|
INSERT INTO t1 VALUES
|
||||||
|
('AB','MySQLAB'),
|
||||||
|
('JA','Sun Microsystems'),
|
||||||
|
('MS','Microsoft'),
|
||||||
|
('IB','IBM- Inc.'),
|
||||||
|
('GO','Google Inc.');
|
||||||
|
|
||||||
|
INSERT IGNORE INTO t2 VALUES
|
||||||
|
('AB','Sweden'),
|
||||||
|
('JA','USA'),
|
||||||
|
('MS','United States'),
|
||||||
|
('IB','North America'),
|
||||||
|
('GO','South America');
|
||||||
|
|
||||||
|
UPDATE t1,t2 SET t1.b=UPPER(t1.b) WHERE t1.b LIKE 'Unknown%';
|
||||||
|
DROP TABLE t1, t2;
|
||||||
|
|
||||||
--echo # End of 10.5 tests
|
--echo # End of 10.5 tests
|
||||||
set optimizer_trace='enabled=off';
|
set optimizer_trace='enabled=off';
|
||||||
|
@ -16453,6 +16453,7 @@ static
|
|||||||
void print_range(String *out, const KEY_PART_INFO *key_part,
|
void print_range(String *out, const KEY_PART_INFO *key_part,
|
||||||
KEY_MULTI_RANGE *range, uint n_key_parts)
|
KEY_MULTI_RANGE *range, uint n_key_parts)
|
||||||
{
|
{
|
||||||
|
Check_level_instant_set check_field(current_thd, CHECK_FIELD_IGNORE);
|
||||||
uint flag= range->range_flag;
|
uint flag= range->range_flag;
|
||||||
String key_name;
|
String key_name;
|
||||||
key_name.set_charset(system_charset_info);
|
key_name.set_charset(system_charset_info);
|
||||||
|
Reference in New Issue
Block a user