mariadb/mysql-test/main/show.result
Monty 6737d68a8e MDEV-32266 All queries in stored procedures increment empty_queries counter
Fixed by setting server_status SERVER_STATUS_RETURNED_ROW if send_data
is called for stored procedures.

This make the definition of Empty_queries well defined:
"Empty_queries" is the number of SELECT queries that returns 0 rows.
2025-11-19 13:46:51 +02:00

145 lines
4.4 KiB
Text

#
# MDEV-9538 Server crashes in check_show_access on SHOW STATISTICS
# MDEV-9539 Server crashes in make_columns_old_format on SHOW GEOMETRY_COLUMNS
# MDEV-9540 SHOW SPATIAL_REF_SYS and SHOW SYSTEM_VARIABLES return empty results with numerous warnings
#
show statistics;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'statistics' at line 1
show spatial_ref_sys
--error ER_PARSE_ERROR
show system_variables;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'spatial_ref_sys
--error ER_PARSE_ERROR
show system_variables' at line 2
show geometry_columns;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'geometry_columns' at line 1
show nonexistent;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'nonexistent' at line 1
#
# MDEV-21603 Crashing SHOW TABLES with derived table in WHERE condition
#
create table t1 (nm varchar(32), a int);
insert t1 values ('1',1),('2',2),('3',3);
show tables
where tables_in_test in (select *
from (select nm from test.t1 group by nm) dt);
Tables_in_test
show fields from test.t1
where field in (select * from (select nm from test.t1 group by nm) dt);
Field Type Null Key Default Extra
insert t1 values ('nm',0);
show fields from test.t1
where field in (select * from (select nm from test.t1 group by nm) dt);
Field Type Null Key Default Extra
nm varchar(32) YES NULL
show fields from test.t1 where field in
(select * from (select column_name from information_schema.columns
where table_name='t1' group by column_name) dt);
Field Type Null Key Default Extra
nm varchar(32) YES NULL
a int(11) YES NULL
drop table t1;
#
# MDEV-4621 select returns null for information_schema.statistics.collation field
#
create table t1 (f varchar(64), key(f));
select index_name, column_name, collation, cardinality from information_schema.STATISTICS where table_schema='test' and table_name='t1';
index_name column_name collation cardinality
f f A NULL
select index_name, column_name, collation from information_schema.STATISTICS where table_schema='test' and table_name='t1';
index_name column_name collation
f f A
drop table t1;
#
# End of 10.2 tests
#
#
# MDEV-28253 Mysqldump - INVISIBLE column error
#
create table t1 (a int, b datetime invisible on update now() without system versioning) with system versioning;
desc t1;
Field Type Null Key Default Extra
a int(11) YES NULL
b datetime YES NULL on update current_timestamp(), INVISIBLE, WITHOUT SYSTEM VERSIONING
drop table t1;
#
# End of 10.3 tests
#
#
# MDEV-31721: Cursor protocol increases the counter of "Empty_queries" for select
#
FLUSH STATUS;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1);
SELECT COUNT(*) FROM t1;
COUNT(*)
1
SELECT * FROM t1;
a
1
SELECT * FROM t1 LIMIT 0;
a
SHOW STATUS LIKE "Empty_queries";
Variable_name Value
Empty_queries 1
DROP TABLE t1;
#------------------------------
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (b INT);
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (2);
SELECT * FROM t1 UNION SELECT * FROM t2;
a
1
2
SELECT * FROM t1 UNION SELECT * FROM t2 LIMIT 0;
a
SHOW STATUS LIKE "Empty_queries";
Variable_name Value
Empty_queries 2
DROP TABLE t1, t2;
#
# MDEV-32266 All queries in stored procedures increment empty_queries counter
#
show status like "Empty_queries";
Variable_name Value
Empty_queries 2
CREATE TABLE t1 (id INT);
insert into t1 values (1),(2);
CREATE PROCEDURE proc1 (OUT cnt INT, id_var int)
BEGIN
SELECT COUNT(*) INTO cnt FROM t1 where id=id_var;
END$$
CREATE PROCEDURE proc2 (id_var int)
BEGIN
declare cnt int;
SELECT id INTO cnt FROM t1 where id=id_var;
END$$
create function f1(x int) returns int return (x in ((select id from t1 where id <= 4)));
flush status;
show status like "Empty_queries";
Variable_name Value
Empty_queries 0
CALL proc1(@cnt,1);
CALL proc1(@cnt,3);
CALL proc2(1);
select f1(1);
f1(1)
1
select f1(8);
f1(8)
0
show status like "Empty_queries";
Variable_name Value
Empty_queries 0
CALL proc2(4);
Warnings:
Warning 1329 No data - zero rows fetched, selected, or processed
show status like "Empty_queries";
Variable_name Value
Empty_queries 1
drop procedure proc1;
drop procedure proc2;
drop function f1;
drop table t1;
# End of 10.11 tests