diff options
author | Sergei Petrunia <sergey@mariadb.com> | 2022-08-04 12:51:32 +0300 |
---|---|---|
committer | Sergei Petrunia <sergey@mariadb.com> | 2022-08-04 17:10:20 +0300 |
commit | 3b071bad1981a12e76769cbfc31b62fbd7362372 (patch) | |
tree | 3c9efd8fc6d8cacbc58251eb499d933a2e731769 | |
parent | ea12dafe6543977bd98c61ffab8cc317b4f0b55b (diff) | |
download | mariadb-git-3b071bad1981a12e76769cbfc31b62fbd7362372.tar.gz |
MDEV-29242: Assertion `computed_weight == weight' failed SEL_ARG::verify_weight
Make SEL_ARG::make_root() maintain SEL_ARG::weight.
Also, an unrelated change: fix dbug_print_sel_arg() to correctly
print SQL NULL for the right endpoint.
-rw-r--r-- | mysql-test/main/range_notembedded.result | 9 | ||||
-rw-r--r-- | mysql-test/main/range_notembedded.test | 9 | ||||
-rw-r--r-- | sql/opt_range.cc | 5 |
3 files changed, 22 insertions, 1 deletions
diff --git a/mysql-test/main/range_notembedded.result b/mysql-test/main/range_notembedded.result index eeab230e72f..6d2f73cd3f9 100644 --- a/mysql-test/main/range_notembedded.result +++ b/mysql-test/main/range_notembedded.result @@ -248,3 +248,12 @@ WHERE (help_topic_id < '2' OR help_topic_id != 8 OR help_topic_id < 1) AND help_keyword_id = help_topic_id; help_topic_id help_keyword_id +# +# MDEV-29242: Assertion `computed_weight == weight' failed SEL_ARG::verify_weight +# +CREATE TABLE t1 (id INT, KEY (id)); +INSERT INTO t1 VALUES (1),(5); +SELECT id FROM t1 WHERE id IS NULL OR id NOT BETWEEN 1 AND 4; +id +5 +DROP TABLE t1; diff --git a/mysql-test/main/range_notembedded.test b/mysql-test/main/range_notembedded.test index 4e77d6a4810..00d16a5d564 100644 --- a/mysql-test/main/range_notembedded.test +++ b/mysql-test/main/range_notembedded.test @@ -150,3 +150,12 @@ FROM mysql.help_relation WHERE (help_topic_id < '2' OR help_topic_id != 8 OR help_topic_id < 1) AND help_keyword_id = help_topic_id; + +--echo # +--echo # MDEV-29242: Assertion `computed_weight == weight' failed SEL_ARG::verify_weight +--echo # +CREATE TABLE t1 (id INT, KEY (id)); +INSERT INTO t1 VALUES (1),(5); +SELECT id FROM t1 WHERE id IS NULL OR id NOT BETWEEN 1 AND 4; +DROP TABLE t1; + diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 1cc573f90f2..ee2ac81abeb 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -1901,7 +1901,9 @@ inline void SEL_ARG::make_root() left=right= &null_element; color=BLACK; next=prev=0; - use_count=0; elements=1; + use_count=0; + elements=1; + weight= 1 + (next_key_part? next_key_part->weight : 0); } SEL_ARG::SEL_ARG(Field *f,const uchar *min_value_arg, @@ -16153,6 +16155,7 @@ const char *dbug_print_sel_arg(SEL_ARG *sel_arg) out.append("+inf"); else { + buf.length(0); print_sel_arg_key(sel_arg->field, sel_arg->max_value, &buf); out.append(buf); } |