1show create procedure mysql.AddGeometryColumn; 2Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation 3AddGeometryColumn CREATE DEFINER=`mariadb.sys`@`localhost` PROCEDURE `AddGeometryColumn`(catalog varchar(64), t_schema varchar(64), 4 t_name varchar(64), geometry_column varchar(64), t_srid int) 5 SQL SECURITY INVOKER 6begin 7 set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' ADD ', geometry_column,' GEOMETRY REF_SYSTEM_ID=', t_srid); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end latin1 latin1_swedish_ci latin1_swedish_ci 8show create procedure mysql.DropGeometryColumn; 9Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation 10DropGeometryColumn CREATE DEFINER=`mariadb.sys`@`localhost` PROCEDURE `DropGeometryColumn`(catalog varchar(64), t_schema varchar(64), 11 t_name varchar(64), geometry_column varchar(64)) 12 SQL SECURITY INVOKER 13begin 14 set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' DROP ', geometry_column); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end latin1 latin1_swedish_ci latin1_swedish_ci 15create table t1 (a int, b int); 16call mysql.AddGeometryColumn('', 'test', 't1', 'c', 10); 17show create table t1; 18Table Create Table 19t1 CREATE TABLE `t1` ( 20 `a` int(11) DEFAULT NULL, 21 `b` int(11) DEFAULT NULL, 22 `c` geometry DEFAULT NULL 23) ENGINE=MyISAM DEFAULT CHARSET=latin1 24call mysql.DropGeometryColumn('', 'test', 't1', 'c'); 25show create table t1; 26Table Create Table 27t1 CREATE TABLE `t1` ( 28 `a` int(11) DEFAULT NULL, 29 `b` int(11) DEFAULT NULL 30) ENGINE=MyISAM DEFAULT CHARSET=latin1 31call mysql.DropGeometryColumn('', 'test', 't1', 'b'); 32show create table t1; 33Table Create Table 34t1 CREATE TABLE `t1` ( 35 `a` int(11) DEFAULT NULL 36) ENGINE=MyISAM DEFAULT CHARSET=latin1 37drop table t1; 38create user foo@localhost; 39grant execute on mysql.* to foo@localhost; 40connect foo, localhost, foo; 41call mysql.AddGeometryColumn('', 'mysql', 'proc', 'c', 10); 42ERROR 42000: ALTER command denied to user 'foo'@'localhost' for table 'proc' 43disconnect foo; 44connection default; 45drop user foo@localhost; 46