Bug #110527 Analyse histogram assertion error
Submitted: 28 Mar 2023 8:36 Modified: 28 Feb 15:52
Reporter: Pedro Ferreira Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S6 (Debug Builds)
Version:8.0.32 OS:Ubuntu (22.04)
Assigned to: CPU Architecture:x86 (x86_64)
Tags: ANALYSE, histogram

[28 Mar 2023 8:36] Pedro Ferreira
Description:
Run the following statements:

CREATE TABLE t0 (c0 TEXT);
INSERT INTO t0(c0) VALUES (1);
ANALYZE LOCAL TABLE t0 UPDATE HISTOGRAM ON c0 WITH 2 BUCKETS;
SELECT 1 FROM (SELECT 1) x(x) JOIN t0 ON reverse(1) = t0.c0;

The SELECT query will give an assertion error at sql/histograms/value_map.cc:52

assert(lhs.charset()->number == rhs.charset()->number);

The compilation parameters are the same as issue 108148:

-DWITH_DEBUG=1 -DWITH_ASAN=ON -DWITH_UBSAN=ON and boost library version 1.77

How to repeat:
Run the statements above.
[28 Mar 2023 9:41] MySQL Verification Team
Hello Pedro Ferreira,

Thank you for the report and feedback.
Observed that 8.0.32 debug build is affected.

regards,
Umesh
[28 Feb 15:52] Jon Stephens
Documented fix as follows in the MySQL 8.4.0 changelog:

    Using a default string histogram on a TEXT column raised an
    assertion due to a collation mismatch when comparing histograms
    bucket values with the String that is returned by REVERSE(1).

Closed.