Commit 4d538250 authored by Varun Gupta's avatar Varun Gupta

MDEV-20349: Assertion `to_len >= 8' failed in convert_to_printable

Use convert_to_printable function to write only non-empty ranges to the optimizer trace
parent c221bcdc
......@@ -6984,4 +6984,46 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
]
]
drop table t0, one_k;
#
# Assertion `to_len >= 8' failed in convert_to_printable
#
CREATE TABLE t1 ( a blob, KEY (a(255)));
insert into t1 values ('foo'), ('bar');
EXPLAIN SELECT * FROM t1 WHERE a= REPEAT('a', 0);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 258 const 1 Using where
SELECT * FROM t1 WHERE a= REPEAT('a', 0);
a
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
[
{
"range_scan_alternatives":
[
{
"index": "a",
"ranges":
[
"() <= (a) <= ()"
],
"rowid_ordered": false,
"using_mrr": false,
"index_only": false,
"rows": 1,
"cost": 2.4265,
"chosen": true
}
],
"analyzing_roworder_intersect":
{
"cause": "too few roworder scans"
},
"analyzing_index_merge_union":
[
]
}
]
DROP TABLE t1;
set optimizer_trace='enabled=off';
......@@ -536,4 +536,17 @@ explain select * from t0 A, one_k B where A.a=B.b and B.a<800;
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
drop table t0, one_k;
--echo #
--echo # Assertion `to_len >= 8' failed in convert_to_printable
--echo #
CREATE TABLE t1 ( a blob, KEY (a(255)));
insert into t1 values ('foo'), ('bar');
EXPLAIN SELECT * FROM t1 WHERE a= REPEAT('a', 0);
SELECT * FROM t1 WHERE a= REPEAT('a', 0);
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
DROP TABLE t1;
set optimizer_trace='enabled=off';
......@@ -1204,6 +1204,8 @@ size_t convert_to_printable_required_length(uint len)
bool String::append_semi_hex(const char *s, uint len, CHARSET_INFO *cs)
{
if (!len)
return false;
size_t dst_len= convert_to_printable_required_length(len);
if (reserve(dst_len))
return true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment