Bug #109723 Exists query assertion error
Submitted: 20 Jan 2023 12:16 Modified: 25 Jan 2023 9:30
Reporter: Pedro Ferreira Email Updates:
Status: Verified 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: exists, subquery

[20 Jan 2023 12:16] Pedro Ferreira
Description:
Run the following queries:

CREATE TABLE t1 (c0 INT);
SET SESSION OPTIMIZER_SWITCH = 'subquery_to_derived=on';
SELECT 1 FROM t1 WHERE NOT EXISTS (VALUES ROW(1),ROW(2));

The select will trigger an assertion error in template_utils.h:100

assert(nullptr != dynamic_cast<Target>(arg));

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 queries above.
[25 Jan 2023 9:30] MySQL Verification Team
Hello Pedro Ferreira,

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

regards,
Umesh
[1 Feb 2023 21:06] Dag Wanvik
Posted by developer:
 
This is a variant of Bug#34746261 Bug#34746261 Forced secondary engine execution assertion error
[6 Feb 2023 16:27] Jon Stephens
Documented fix as follows in the MySQL 8.0.33 changelog:

    A query of the form SELECT 1 FROM t1 WHERE NOT EXISTS (VALUES
    ROW(1), ROW(2)) caused an assert in debug builds when the
    subquery_to_derived optimizer switch was enabled.

Closed.