Bug #112145 Insert on duplicate assertion error

Submitted: 23 Aug 2023 2:49 Modified: 15 Sep 2023 14:48
Reporter: Pedro Ferreira Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: DML Severity:S6 (Debug Builds)
Version:8.1.0 OS:Ubuntu (22.04)
Assigned to: CPU Architecture:x86 (x86_64)
Tags: duplicate, except, insert

[23 Aug 2023 2:49] Pedro Ferreira
Description:
Run these queries

CREATE TABLE t1 (c1 BOOLEAN);
INSERT INTO t1 (c1) ((SELECT 2) EXCEPT (SELECT 1)) ON DUPLICATE KEY UPDATE c1 = 1 IN (SELECT 1);

The insert query will trigger an assertion error at sql/item_subselect.cc:2660
assert(outer == query_expr()->outer_query_block());

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.
[23 Aug 2023 9:01] MySQL Verification Team
Hello Pedro Ferreira,

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

regards,
Umesh
[23 Aug 2023 9:02] MySQL Verification Team
- 8.1.0 debug build

bin/mysql -uroot -S /tmp/mysql.sock
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 8.1.0-debug MySQL Community Server - GPL - Debug

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database test;
Query OK, 1 row affected (0.01 sec)

mysql> use test
Database changed
mysql> CREATE TABLE t1 (c1 BOOLEAN);
Query OK, 0 rows affected (0.05 sec)

mysql> INSERT INTO t1 (c1) ((SELECT 2) EXCEPT (SELECT 1)) ON DUPLICATE KEY UPDATE c1 = 1 IN (SELECT 1);
ERROR 2013 (HY000): Lost connection to MySQL server during query
No connection. Trying to reconnect...

-bt

(gdb) bt
#0  0x00007fe300571aa1 in pthread_kill () from /lib64/libpthread.so.0
#1  0x0000000004076b77 in my_write_core(int) ()
#2  0x000000000330766e in handle_fatal_signal ()
#3  <signal handler called>
#4  0x00007fe2fe8bc387 in raise () from /lib64/libc.so.6
#5  0x00007fe2fe8bda78 in abort () from /lib64/libc.so.6
#6  0x00007fe2fe8b51a6 in __assert_fail_base () from /lib64/libc.so.6
#7  0x00007fe2fe8b5252 in __assert_fail () from /lib64/libc.so.6
#8  0x0000000003506ad3 in Item_exists_subselect::fix_fields(THD*, Item**) ()
#9  0x00000000030d8de4 in setup_fields(THD*, unsigned long, bool, bool, bool, mem_root_deque<Item*> const*, mem_root_deque<Item*>*, Bounds_checked_array<Item*>) ()
#10 0x000000000366828d in Sql_cmd_insert_base::resolve_update_expressions(THD*) ()
#11 0x000000000366cdd4 in Sql_cmd_insert_base::prepare_inner(THD*) ()
#12 0x00000000031efdad in Sql_cmd_dml::prepare(THD*) ()
#13 0x00000000031f00d5 in Sql_cmd_dml::execute(THD*) ()
#14 0x000000000318eb63 in mysql_execute_command(THD*, bool) ()
#15 0x0000000003192579 in dispatch_sql_command(THD*, Parser_state*) ()
#16 0x0000000003193b7f in dispatch_command(THD*, COM_DATA const*, enum_server_command) ()
#17 0x0000000003195763 in do_command(THD*) ()
#18 0x00000000032f967c in handle_connection ()
#19 0x000000000482e4e4 in pfs_spawn_thread ()
#20 0x00007fe30056cea5 in start_thread () from /lib64/libpthread.so.0
#21 0x00007fe2fe984b2d in clone () from /lib64/libc.so.6
[15 Sep 2023 14:48] Christine Cole
Posted by developer:
 
No visible effects in release builds. No changelog needed. 
Closed.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.