|
Thanks for the report! Reproducible on 5.5-10.4:
create table t1 (c1 varchar(30),c2 varchar(150),unique index t1_idx (c2,c1));
|
insert into t1 values ('a','a'),('b','b'),('c','c');
|
|
delimiter |;
|
create procedure p1()
|
begin
|
declare x varchar(30);
|
select max(c1) into @x from t1 where c2='a';
|
select found_rows();
|
select @x;
|
end;
|
|
|
|
delimiter ;|
|
call p1();
|
drop index t1_idx on t1;
|
call p1();
|
|
drop procedure p1;
|
drop table t1;
|
MariaDB [test]> call p1();
|
+--------------+
|
| found_rows() |
|
+--------------+
|
| 0 |
|
+--------------+
|
1 row in set (0.001 sec)
|
|
+------+
|
| @x |
|
+------+
|
| a |
|
+------+
|
1 row in set (0.001 sec)
|
|
Query OK, 1 row affected (0.001 sec)
|
|
MariaDB [test]> drop index t1_idx on t1;
|
Query OK, 0 rows affected (0.020 sec)
|
Records: 0 Duplicates: 0 Warnings: 0
|
|
MariaDB [test]> call p1();
|
+--------------+
|
| found_rows() |
|
+--------------+
|
| 1 |
|
+--------------+
|
1 row in set (0.000 sec)
|
|
+------+
|
| @x |
|
+------+
|
| a |
|
+------+
|
1 row in set (0.000 sec)
|
|
Query OK, 1 row affected (0.000 sec)
|
|