mariadb/mysql-test/main/system_tables.test
Yuchen Pei 4bab5d087c
MDEV-35622 Add validation of servers, plugins and grant table column counts
This fixes segfaults in subsequent readings of these tables, if some
columns are missing.
2025-04-14 15:41:21 +10:00

35 lines
1.3 KiB
Text

--echo #
--echo # MDEV-35622 SEGV when reading system table with less than expected number of columns
--echo #
create table mysql.servers_save like mysql.servers;
ALTER TABLE mysql.servers DROP COLUMN Owner;
INSERT INTO mysql.servers VALUES(0,0,0,0,0,0,0,0);
call mtr.add_suppression('\\[ERROR\\] Column count of mysql.servers is wrong');
--error ER_UNKNOWN_ERROR
FLUSH PRIVILEGES;
drop table mysql.servers;
rename table mysql.servers_save to mysql.servers;
create table mysql.plugin_save like mysql.plugin;
alter table mysql.plugin drop column dl;
--error ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2
install soname "ha_example";
drop table mysql.plugin;
rename table mysql.plugin_save to mysql.plugin;
rename table mysql.procs_priv to mysql.procs_priv_save;
CREATE OR REPLACE TABLE mysql.procs_priv (id INT);
INSERT INTO mysql.procs_priv VALUES(0);
--error ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2
CREATE ROLE r;
drop table mysql.procs_priv;
rename table mysql.procs_priv_save to mysql.procs_priv;
create table mysql.plugin_save like mysql.plugin;
install soname "ha_example";
alter table mysql.plugin drop column dl;
call mtr.add_suppression('\\[ERROR\\] Column count of mysql.plugin is wrong');
--source include/restart_mysqld.inc
drop table mysql.plugin;
rename table mysql.plugin_save to mysql.plugin;