@@ -605,3 +605,40 @@ prepare stmt1x from 'select count(*) from system.statement_info limit 0';
605605execute stmt1x;
606606count(*)
607607drop account prepare_acc01;
608+ create database prepare_test_2;
609+ use prepare_test_2;
610+ drop table if exists tb_delete_opt_to_truncate;
611+ create table tb_delete_opt_to_truncate(col1 int, col2 int);
612+ insert into tb_delete_opt_to_truncate values(1, 2), (2,3);
613+ prepare st_delete_opt_to_truncate from select * from tb_delete_opt_to_truncate order by col1;
614+ execute st_delete_opt_to_truncate;
615+ col1 col2
616+ 1 2
617+ 2 3
618+ delete from tb_delete_opt_to_truncate;
619+ execute st_delete_opt_to_truncate;
620+ internal error: table 'tb_delete_opt_to_truncate' has been changed, please reset prepare statement 'st_delete_opt_to_truncate'
621+ set session delete_opt_to_truncate = 0;
622+ insert into tb_delete_opt_to_truncate values(1, 2), (2,3);
623+ prepare st_delete_opt_to_truncate from select * from tb_delete_opt_to_truncate order by col1;
624+ execute st_delete_opt_to_truncate;
625+ col1 col2
626+ 1 2
627+ 2 3
628+ delete from tb_delete_opt_to_truncate;
629+ execute st_delete_opt_to_truncate;
630+ col1 col2
631+ set session delete_opt_to_truncate = 1;
632+ insert into tb_delete_opt_to_truncate values(1, 2), (2,3);
633+ prepare st_delete_opt_to_truncate from select * from tb_delete_opt_to_truncate order by col1;
634+ execute st_delete_opt_to_truncate;
635+ col1 col2
636+ 1 2
637+ 2 3
638+ delete from tb_delete_opt_to_truncate;
639+ execute st_delete_opt_to_truncate;
640+ internal error: table 'tb_delete_opt_to_truncate' has been changed, please reset prepare statement 'st_delete_opt_to_truncate'
641+ set session delete_opt_to_truncate = 123;
642+ internal error: convert to the system variable bool type failed
643+ drop table tb_delete_opt_to_truncate;
644+ drop database prepare_test_2;
0 commit comments