Commit a49239b5 authored by Eugene Kosov's avatar Eugene Kosov Committed by GitHub

SQL: truncate syntax and privilege [closes #229]

parent 904b69cd
This diff is collapsed.
This diff is collapsed.
......@@ -23,7 +23,7 @@ SHOW GRANTS;
Grants for ev_test@localhost
GRANT USAGE ON *.* TO 'ev_test'@'localhost'
GRANT ALL PRIVILEGES ON `events_test`.* TO 'ev_test'@'localhost'
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, TRIGGER ON `events_test2`.* TO 'ev_test'@'localhost'
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, TRIGGER, DELETE VERSIONING ROWS ON `events_test2`.* TO 'ev_test'@'localhost'
"Here comes an error:";
SHOW EVENTS;
ERROR 42000: Access denied for user 'ev_test'@'localhost' to database 'events_test2'
......
......@@ -49,6 +49,7 @@ Create_user_priv N
Event_priv N
Trigger_priv N
Create_tablespace_priv N
Delete_versioning_rows_priv N
ssl_type SPECIFIED
ssl_cipher EDH-RSA-DES-CBC3-SHA
x509_issuer
......@@ -124,6 +125,7 @@ Create_user_priv N
Event_priv N
Trigger_priv N
Create_tablespace_priv N
Delete_versioning_rows_priv N
ssl_type
ssl_cipher
x509_issuer
......@@ -175,6 +177,7 @@ Create_user_priv N
Event_priv N
Trigger_priv N
Create_tablespace_priv N
Delete_versioning_rows_priv N
ssl_type
ssl_cipher
x509_issuer
......@@ -223,7 +226,7 @@ revoke LOCK TABLES, ALTER on mysqltest.* from mysqltest_1@localhost;
show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, CREATE TEMPORARY TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER ON `mysqltest`.* TO 'mysqltest_1'@'localhost' WITH GRANT OPTION
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, CREATE TEMPORARY TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER, DELETE VERSIONING ROWS ON `mysqltest`.* TO 'mysqltest_1'@'localhost' WITH GRANT OPTION
revoke all privileges on mysqltest.* from mysqltest_1@localhost;
delete from mysql.user where user='mysqltest_1';
flush privileges;
......@@ -609,6 +612,7 @@ Create temporary tables Databases To use CREATE TEMPORARY TABLE
Create view Tables To create new views
Create user Server Admin To create new users
Delete Tables To delete existing rows
Delete versioning rows Tables To delete versioning table historical rows
Drop Databases,Tables To drop databases, tables, and views
Event Server Admin To create, alter, drop and execute events
Execute Functions,Procedures To execute stored routines
......@@ -664,8 +668,8 @@ SELECT TABLE_SCHEMA, TABLE_NAME, GROUP_CONCAT(PRIVILEGE_TYPE ORDER BY
PRIVILEGE_TYPE SEPARATOR ', ') AS PRIVILEGES FROM TABLE_PRIVILEGES WHERE GRANTEE
= '\'dummy\'@\'localhost\'' GROUP BY TABLE_SCHEMA, TABLE_NAME;
TABLE_SCHEMA TABLE_NAME PRIVILEGES
mysqltest dummytable ALTER, CREATE, CREATE VIEW, DELETE, DROP, INDEX, INSERT, REFERENCES, SELECT, SHOW VIEW, TRIGGER, UPDATE
mysqltest dummyview ALTER, CREATE, CREATE VIEW, DELETE, DROP, INDEX, INSERT, REFERENCES, SELECT, SHOW VIEW, TRIGGER, UPDATE
mysqltest dummytable ALTER, CREATE, CREATE VIEW, DELETE, DELETE VERSIONING ROWS, DROP, INDEX, INSERT, REFERENCES, SELECT, SHOW VIEW, TRIGGER, UPDATE
mysqltest dummyview ALTER, CREATE, CREATE VIEW, DELETE, DELETE VERSIONING ROWS, DROP, INDEX, INSERT, REFERENCES, SELECT, SHOW VIEW, TRIGGER, UPDATE
FLUSH PRIVILEGES;
SHOW GRANTS FOR dummy@localhost;
Grants for dummy@localhost
......@@ -676,8 +680,8 @@ SELECT TABLE_SCHEMA, TABLE_NAME, GROUP_CONCAT(PRIVILEGE_TYPE ORDER BY
PRIVILEGE_TYPE SEPARATOR ', ') AS PRIVILEGES FROM TABLE_PRIVILEGES WHERE GRANTEE
= '\'dummy\'@\'localhost\'' GROUP BY TABLE_SCHEMA, TABLE_NAME;
TABLE_SCHEMA TABLE_NAME PRIVILEGES
mysqltest dummytable ALTER, CREATE, CREATE VIEW, DELETE, DROP, INDEX, INSERT, REFERENCES, SELECT, SHOW VIEW, TRIGGER, UPDATE
mysqltest dummyview ALTER, CREATE, CREATE VIEW, DELETE, DROP, INDEX, INSERT, REFERENCES, SELECT, SHOW VIEW, TRIGGER, UPDATE
mysqltest dummytable ALTER, CREATE, CREATE VIEW, DELETE, DELETE VERSIONING ROWS, DROP, INDEX, INSERT, REFERENCES, SELECT, SHOW VIEW, TRIGGER, UPDATE
mysqltest dummyview ALTER, CREATE, CREATE VIEW, DELETE, DELETE VERSIONING ROWS, DROP, INDEX, INSERT, REFERENCES, SELECT, SHOW VIEW, TRIGGER, UPDATE
SHOW FIELDS FROM mysql.tables_priv;
Field Type Null Key Default Extra
Host char(60) NO PRI
......@@ -686,7 +690,7 @@ User char(80) NO PRI
Table_name char(64) NO PRI
Grantor char(141) NO MUL
Timestamp timestamp NO current_timestamp() on update current_timestamp()
Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') NO
Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger','Delete versioning rows') NO
Column_priv set('Select','Insert','Update','References') NO
use test;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM dummy@localhost;
......@@ -769,7 +773,7 @@ flush privileges;
use test;
set @user123="non-existent";
select * from mysql.db where user=@user123;
Host Db User Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Grant_priv References_priv Index_priv Alter_priv Create_tmp_table_priv Lock_tables_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Execute_priv Event_priv Trigger_priv
Host Db User Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Grant_priv References_priv Index_priv Alter_priv Create_tmp_table_priv Lock_tables_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Execute_priv Event_priv Trigger_priv Delete_versioning_rows_priv
set names koi8r;
create database ;
grant select on .* to root@localhost;
......
......@@ -488,6 +488,7 @@ GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
'mysqltest_1'@'localhost' def test ALTER ROUTINE YES
'mysqltest_1'@'localhost' def test EVENT YES
'mysqltest_1'@'localhost' def test TRIGGER YES
'mysqltest_1'@'localhost' def test DELETE VERSIONING ROWS YES
select * from information_schema.TABLE_PRIVILEGES where grantee like '%mysqltest_1%';
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
'mysqltest_1'@'localhost' def test t1 SELECT NO
......@@ -744,6 +745,7 @@ Lock_tables_priv select,insert,update,references
Show_view_priv select,insert,update,references
Create_routine_priv select,insert,update,references
Alter_routine_priv select,insert,update,references
Delete_versioning_rows_priv select,insert,update,references
max_questions select,insert,update,references
max_connections select,insert,update,references
max_user_connections select,insert,update,references
......
......@@ -7,8 +7,8 @@ Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
select * from db where user = 'mysqltest_1';
Host Db User Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Grant_priv References_priv Index_priv Alter_priv Create_tmp_table_priv Lock_tables_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Execute_priv Event_priv Trigger_priv
localhost mysqltest mysqltest_1 Y Y Y Y Y Y N Y Y Y Y Y Y Y Y Y Y Y Y
Host Db User Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Grant_priv References_priv Index_priv Alter_priv Create_tmp_table_priv Lock_tables_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Execute_priv Event_priv Trigger_priv Delete_versioning_rows_priv
localhost mysqltest mysqltest_1 Y Y Y Y Y Y N Y Y Y Y Y Y Y Y Y Y Y Y Y
update db set db = 'MYSQLtest' where db = 'mysqltest' and user = 'mysqltest_1' and host = 'localhost';
flush privileges;
show grants for mysqltest_1@localhost;
......@@ -16,8 +16,8 @@ Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
select * from db where user = 'mysqltest_1';
Host Db User Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Grant_priv References_priv Index_priv Alter_priv Create_tmp_table_priv Lock_tables_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Execute_priv Event_priv Trigger_priv
localhost MYSQLtest mysqltest_1 Y Y Y Y Y Y N Y Y Y Y Y Y Y Y Y Y Y Y
Host Db User Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Grant_priv References_priv Index_priv Alter_priv Create_tmp_table_priv Lock_tables_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Execute_priv Event_priv Trigger_priv Delete_versioning_rows_priv
localhost MYSQLtest mysqltest_1 Y Y Y Y Y Y N Y Y Y Y Y Y Y Y Y Y Y Y Y
delete from db where db = 'MYSQLtest' and user = 'mysqltest_1' and host = 'localhost';
flush privileges;
drop user mysqltest_1@localhost;
......
......@@ -42,6 +42,7 @@ Create_user_priv enum('N','Y') NO N
Event_priv enum('N','Y') NO N
Trigger_priv enum('N','Y') NO N
Create_tablespace_priv enum('N','Y') NO N
Delete_versioning_rows_priv enum('N','Y') NO N
ssl_type enum('','ANY','X509','SPECIFIED') NO
ssl_cipher blob NO NULL
x509_issuer blob NO NULL
......
......@@ -1207,21 +1207,21 @@ SET @aux= "SELECT COUNT(*)
prepare my_stmt from @aux;
execute my_stmt;
COUNT(*)
46
47
Warnings:
Warning 1286 Unknown storage engine 'InnoDB'
Warning 1286 Unknown storage engine 'InnoDB'
Warning 1286 Unknown storage engine 'InnoDB'
execute my_stmt;
COUNT(*)
46
47
Warnings:
Warning 1286 Unknown storage engine 'InnoDB'
Warning 1286 Unknown storage engine 'InnoDB'
Warning 1286 Unknown storage engine 'InnoDB'
execute my_stmt;
COUNT(*)
46
47
Warnings:
Warning 1286 Unknown storage engine 'InnoDB'
Warning 1286 Unknown storage engine 'InnoDB'
......
......@@ -531,7 +531,7 @@ SET SESSION SQL_MODE = @OLD_SQL_MODE;
DROP USER 'user_no_PCTFL'@'localhost';
FLUSH PRIVILEGES;
SELECT * FROM mysql.db WHERE Host = 'localhost' AND User LIKE 'user_%PCTFL';
Host Db User Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Grant_priv References_priv Index_priv Alter_priv Create_tmp_table_priv Lock_tables_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Execute_priv Event_priv Trigger_priv
Host Db User Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Grant_priv References_priv Index_priv Alter_priv Create_tmp_table_priv Lock_tables_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Execute_priv Event_priv Trigger_priv Delete_versioning_rows_priv
SELECT * FROM mysql.tables_priv WHERE Host = 'localhost' AND User LIKE 'user_%PCTFL';
Host Db User Table_name Grantor Timestamp Table_priv Column_priv
SELECT * FROM mysql.columns_priv WHERE Host = 'localhost' AND User LIKE 'user_%PCTFL';
......
......@@ -56,6 +56,7 @@ db CREATE TABLE `db` (
`Execute_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`Event_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`Trigger_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`Delete_versioning_rows_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
PRIMARY KEY (`Host`,`Db`,`User`),
KEY `User` (`User`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Database privileges'
......@@ -119,6 +120,7 @@ user CREATE TABLE `user` (
`Event_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`Trigger_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`Create_tablespace_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`Delete_versioning_rows_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`ssl_type` enum('','ANY','X509','SPECIFIED') CHARACTER SET utf8 NOT NULL DEFAULT '',
`ssl_cipher` blob NOT NULL,
`x509_issuer` blob NOT NULL,
......@@ -153,7 +155,7 @@ tables_priv CREATE TABLE `tables_priv` (
`Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`Grantor` char(141) COLLATE utf8_bin NOT NULL DEFAULT '',
`Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') CHARACTER SET utf8 NOT NULL DEFAULT '',
`Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger','Delete versioning rows') CHARACTER SET utf8 NOT NULL DEFAULT '',
`Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '',
PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`),
KEY `Grantor` (`Grantor`)
......
......@@ -56,6 +56,7 @@ db CREATE TABLE `db` (
`Execute_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`Event_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`Trigger_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`Delete_versioning_rows_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
PRIMARY KEY (`Host`,`Db`,`User`),
KEY `User` (`User`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Database privileges'
......@@ -118,6 +119,7 @@ user CREATE TABLE `user` (
`Create_user_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`Event_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`Trigger_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`Delete_versioning_rows_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`Create_tablespace_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`ssl_type` enum('','ANY','X509','SPECIFIED') CHARACTER SET utf8 NOT NULL DEFAULT '',
`ssl_cipher` blob NOT NULL,
......@@ -153,7 +155,7 @@ tables_priv CREATE TABLE `tables_priv` (
`Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`Grantor` char(141) COLLATE utf8_bin NOT NULL DEFAULT '',
`Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') CHARACTER SET utf8 NOT NULL DEFAULT '',
`Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger','Delete versioning rows') CHARACTER SET utf8 NOT NULL DEFAULT '',
`Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '',
PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`),
KEY `Grantor` (`Grantor`)
......
......@@ -56,6 +56,7 @@ db CREATE TABLE `db` (
`Execute_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`Event_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`Trigger_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`Delete_versioning_rows_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
PRIMARY KEY (`Host`,`Db`,`User`),
KEY `User` (`User`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Database privileges'
......@@ -118,6 +119,7 @@ user CREATE TABLE `user` (
`Create_user_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`Event_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`Trigger_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`Delete_versioning_rows_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`Create_tablespace_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`ssl_type` enum('','ANY','X509','SPECIFIED') CHARACTER SET utf8 NOT NULL DEFAULT '',
`ssl_cipher` blob NOT NULL,
......@@ -153,7 +155,7 @@ tables_priv CREATE TABLE `tables_priv` (
`Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`Grantor` char(141) COLLATE utf8_bin NOT NULL DEFAULT '',
`Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') CHARACTER SET utf8 NOT NULL DEFAULT '',
`Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger','Delete versioning rows') CHARACTER SET utf8 NOT NULL DEFAULT '',
`Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '',
PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`),
KEY `Grantor` (`Grantor`)
......
......@@ -56,6 +56,7 @@ db CREATE TABLE `db` (
`Execute_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`Event_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`Trigger_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`Delete_versioning_rows_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
PRIMARY KEY (`Host`,`Db`,`User`),
KEY `User` (`User`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Database privileges'
......@@ -118,6 +119,7 @@ user CREATE TABLE `user` (
`Create_user_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`Event_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`Trigger_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`Delete_versioning_rows_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`Create_tablespace_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`ssl_type` enum('','ANY','X509','SPECIFIED') CHARACTER SET utf8 NOT NULL DEFAULT '',
`ssl_cipher` blob NOT NULL,
......@@ -153,7 +155,7 @@ tables_priv CREATE TABLE `tables_priv` (
`Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`Grantor` char(141) COLLATE utf8_bin NOT NULL DEFAULT '',
`Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') CHARACTER SET utf8 NOT NULL DEFAULT '',
`Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger','Delete versioning rows') CHARACTER SET utf8 NOT NULL DEFAULT '',
`Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '',
PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`),
KEY `Grantor` (`Grantor`)
......
......@@ -603,7 +603,7 @@ trig 1_1-yes
revoke TRIGGER on *.* from test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE, DELETE VERSIONING ROWS ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
disconnect yes_privs;
connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
select current_user;
......@@ -656,7 +656,7 @@ root@localhost
grant TRIGGER on priv_db.* to test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE, DELETE VERSIONING ROWS ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT TRIGGER ON `priv_db`.* TO 'test_yesprivs'@'localhost'
trigger privilege on db level for create:
......@@ -929,7 +929,7 @@ grant TRIGGER on priv1_db.t1 to test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT ON `priv1_db`.* TO 'test_yesprivs'@'localhost'
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, DELETE VERSIONING ROWS ON `priv1_db`.* TO 'test_yesprivs'@'localhost'
GRANT SELECT, UPDATE ON `priv2_db`.* TO 'test_yesprivs'@'localhost'
GRANT TRIGGER ON `priv1_db`.`t1` TO 'test_yesprivs'@'localhost'
......
......@@ -140,6 +140,7 @@ GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
'testuser3'@'localhost' def db_datadict CREATE TEMPORARY TABLES NO
'testuser3'@'localhost' def db_datadict CREATE VIEW NO
'testuser3'@'localhost' def db_datadict DELETE NO
'testuser3'@'localhost' def db_datadict DELETE VERSIONING ROWS NO
'testuser3'@'localhost' def db_datadict DROP NO
'testuser3'@'localhost' def db_datadict EVENT NO
'testuser3'@'localhost' def db_datadict EXECUTE NO
......
......@@ -68,6 +68,7 @@ GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE
''@'%' def test CREATE ROUTINE
''@'%' def test EVENT
''@'%' def test TRIGGER
''@'%' def test DELETE VERSIONING ROWS
''@'%' def test\_% SELECT
''@'%' def test\_% INSERT
''@'%' def test\_% UPDATE
......@@ -84,6 +85,7 @@ GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE
''@'%' def test\_% CREATE ROUTINE
''@'%' def test\_% EVENT
''@'%' def test\_% TRIGGER
''@'%' def test\_% DELETE VERSIONING ROWS
###############################################################################
# Testcase 3.2.15.2-3.2.15.4 INFORMATION_SCHEMA.SCHEMA_PRIVILEGES accessibility
###############################################################################
......
......@@ -16,6 +16,7 @@ GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
''@'%' def test CREATE TEMPORARY TABLES NO
''@'%' def test CREATE VIEW NO
''@'%' def test DELETE NO
''@'%' def test DELETE VERSIONING ROWS NO
''@'%' def test DROP NO
''@'%' def test EVENT NO
''@'%' def test INDEX NO
......
......@@ -96,6 +96,7 @@ GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
'testuser2'@'localhost' def db_datadict tb1 CREATE YES
'testuser2'@'localhost' def db_datadict tb1 CREATE VIEW YES
'testuser2'@'localhost' def db_datadict tb1 DELETE YES
'testuser2'@'localhost' def db_datadict tb1 DELETE VERSIONING ROWS YES
'testuser2'@'localhost' def db_datadict tb1 DROP YES
'testuser2'@'localhost' def db_datadict tb1 INDEX YES
'testuser2'@'localhost' def db_datadict tb1 INSERT YES
......@@ -131,6 +132,7 @@ GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
'testuser2'@'localhost' def db_datadict tb1 CREATE YES
'testuser2'@'localhost' def db_datadict tb1 CREATE VIEW YES
'testuser2'@'localhost' def db_datadict tb1 DELETE YES
'testuser2'@'localhost' def db_datadict tb1 DELETE VERSIONING ROWS YES
'testuser2'@'localhost' def db_datadict tb1 DROP YES
'testuser2'@'localhost' def db_datadict tb1 INDEX YES
'testuser2'@'localhost' def db_datadict tb1 INSERT YES
......@@ -184,6 +186,7 @@ GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
'testuser1'@'localhost' def test t1_table CREATE NO
'testuser1'@'localhost' def test t1_table CREATE VIEW NO
'testuser1'@'localhost' def test t1_table DELETE NO
'testuser1'@'localhost' def test t1_table DELETE VERSIONING ROWS NO
'testuser1'@'localhost' def test t1_table DROP NO
'testuser1'@'localhost' def test t1_table INDEX NO
'testuser1'@'localhost' def test t1_table INSERT NO
......@@ -196,6 +199,7 @@ GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
'testuser1'@'localhost' def test t1_view CREATE NO
'testuser1'@'localhost' def test t1_view CREATE VIEW NO
'testuser1'@'localhost' def test t1_view DELETE NO
'testuser1'@'localhost' def test t1_view DELETE VERSIONING ROWS NO
'testuser1'@'localhost' def test t1_view DROP NO
'testuser1'@'localhost' def test t1_view INDEX NO
'testuser1'@'localhost' def test t1_view INSERT NO
......
......@@ -144,7 +144,7 @@ connect testuser2, localhost, testuser2, , db_datadict;
SHOW GRANTS FOR 'testuser2'@'localhost';
Grants for testuser2@localhost
GRANT USAGE ON *.* TO 'testuser2'@'localhost'
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW ON `db_datadict`.`t1` TO 'testuser2'@'localhost'
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, DELETE VERSIONING ROWS ON `db_datadict`.`t1` TO 'testuser2'@'localhost'
# No TRIGGER Privilege --> no result for query
SELECT * FROM information_schema.triggers
WHERE trigger_name = 'trg1';
......
......@@ -119,6 +119,7 @@ Create_user_priv N
Event_priv N
Trigger_priv N
Create_tablespace_priv N
Delete_versioning_rows_priv N
ssl_type
ssl_cipher
x509_issuer
......@@ -165,6 +166,7 @@ Create_user_priv N
Event_priv N
Trigger_priv N
Create_tablespace_priv N
Delete_versioning_rows_priv N
ssl_type
ssl_cipher
x509_issuer
......@@ -211,6 +213,7 @@ Create_user_priv N
Event_priv N
Trigger_priv N
Create_tablespace_priv N
Delete_versioning_rows_priv N
ssl_type
ssl_cipher
x509_issuer
......@@ -281,6 +284,7 @@ Create_user_priv N
Event_priv N
Trigger_priv N
Create_tablespace_priv N
Delete_versioning_rows_priv N
ssl_type
ssl_cipher
x509_issuer
......@@ -327,6 +331,7 @@ Create_user_priv N
Event_priv N
Trigger_priv N
Create_tablespace_priv N
Delete_versioning_rows_priv N
ssl_type
ssl_cipher
x509_issuer
......@@ -373,6 +378,7 @@ Create_user_priv N
Event_priv N
Trigger_priv N
Create_tablespace_priv N
Delete_versioning_rows_priv N
ssl_type
ssl_cipher
x509_issuer
......@@ -429,6 +435,7 @@ Create_user_priv N
Event_priv N
Trigger_priv N
Create_tablespace_priv N
Delete_versioning_rows_priv N
ssl_type
ssl_cipher
x509_issuer
......@@ -475,6 +482,7 @@ Create_user_priv N
Event_priv N
Trigger_priv N
Create_tablespace_priv N
Delete_versioning_rows_priv N
ssl_type
ssl_cipher
x509_issuer
......@@ -521,6 +529,7 @@ Create_user_priv N
Event_priv N
Trigger_priv N
Create_tablespace_priv N
Delete_versioning_rows_priv N
ssl_type
ssl_cipher
x509_issuer
......@@ -599,6 +608,7 @@ Create_user_priv N
Event_priv N
Trigger_priv N
Create_tablespace_priv N
Delete_versioning_rows_priv N
ssl_type
ssl_cipher
x509_issuer
......@@ -645,6 +655,7 @@ Create_user_priv N
Event_priv N
Trigger_priv N
Create_tablespace_priv N
Delete_versioning_rows_priv N
ssl_type
ssl_cipher
x509_issuer
......@@ -691,6 +702,7 @@ Create_user_priv N
Event_priv N
Trigger_priv N
Create_tablespace_priv N
Delete_versioning_rows_priv N
ssl_type
ssl_cipher
x509_issuer
......@@ -761,6 +773,7 @@ Create_user_priv N
Event_priv N
Trigger_priv N
Create_tablespace_priv N
Delete_versioning_rows_priv N
ssl_type
ssl_cipher
x509_issuer
......@@ -807,6 +820,7 @@ Create_user_priv N
Event_priv N
Trigger_priv N
Create_tablespace_priv N
Delete_versioning_rows_priv N
ssl_type
ssl_cipher
x509_issuer
......@@ -853,6 +867,7 @@ Create_user_priv N
Event_priv N
Trigger_priv N
Create_tablespace_priv N
Delete_versioning_rows_priv N
ssl_type
ssl_cipher
x509_issuer
......@@ -909,6 +924,7 @@ Create_user_priv N
Event_priv N
Trigger_priv N
Create_tablespace_priv N
Delete_versioning_rows_priv N
ssl_type
ssl_cipher
x509_issuer
......@@ -955,6 +971,7 @@ Create_user_priv N
Event_priv N
Trigger_priv N
Create_tablespace_priv N
Delete_versioning_rows_priv N
ssl_type
ssl_cipher
x509_issuer
......@@ -1001,6 +1018,7 @@ Create_user_priv N
Event_priv N
Trigger_priv N
Create_tablespace_priv N
Delete_versioning_rows_priv N
ssl_type
ssl_cipher
x509_issuer
......@@ -1109,6 +1127,7 @@ Create_user_priv N
Event_priv N
Trigger_priv N
Create_tablespace_priv N
Delete_versioning_rows_priv N
ssl_type
ssl_cipher
x509_issuer
......@@ -1155,6 +1174,7 @@ Create_user_priv N
Event_priv N
Trigger_priv N
Create_tablespace_priv N
Delete_versioning_rows_priv N
ssl_type
ssl_cipher
x509_issuer
......@@ -1201,6 +1221,7 @@ Create_user_priv N
Event_priv N
Trigger_priv N
Create_tablespace_priv N
Delete_versioning_rows_priv N
ssl_type
ssl_cipher
x509_issuer
......@@ -1304,6 +1325,7 @@ Create_user_priv N
Event_priv N
Trigger_priv N
Create_tablespace_priv N
Delete_versioning_rows_priv N
ssl_type
ssl_cipher
x509_issuer
......@@ -1350,6 +1372,7 @@ Create_user_priv N
Event_priv N
Trigger_priv N
Create_tablespace_priv N
Delete_versioning_rows_priv N
ssl_type
ssl_cipher
x509_issuer
......@@ -1396,6 +1419,7 @@ Create_user_priv N
Event_priv N
Trigger_priv N
Create_tablespace_priv N
Delete_versioning_rows_priv N
ssl_type
ssl_cipher
x509_issuer
......@@ -1452,6 +1476,7 @@ Create_user_priv N
Event_priv N
Trigger_priv N
Create_tablespace_priv N
Delete_versioning_rows_priv N
ssl_type
ssl_cipher
x509_issuer
......@@ -1498,6 +1523,7 @@ Create_user_priv N
Event_priv N
Trigger_priv N
Create_tablespace_priv N
Delete_versioning_rows_priv N
ssl_type
ssl_cipher
x509_issuer
......@@ -1544,6 +1570,7 @@ Create_user_priv N
Event_priv N
Trigger_priv N
Create_tablespace_priv N
Delete_versioning_rows_priv N
ssl_type
ssl_cipher
x509_issuer
......@@ -1607,6 +1634,7 @@ Create_user_priv N
Event_priv N
Trigger_priv N
Create_tablespace_priv N
Delete_versioning_rows_priv N
ssl_type
ssl_cipher
x509_issuer
......@@ -1653,6 +1681,7 @@ Create_user_priv N
Event_priv N
Trigger_priv N
Create_tablespace_priv N
Delete_versioning_rows_priv N
ssl_type
ssl_cipher
x509_issuer
......@@ -1699,6 +1728,7 @@ Create_user_priv N
Event_priv N
Trigger_priv N
Create_tablespace_priv N
Delete_versioning_rows_priv N
ssl_type
ssl_cipher
x509_issuer
......@@ -1777,6 +1807,7 @@ Create_user_priv N
Event_priv N
Trigger_priv N
Create_tablespace_priv N
Delete_versioning_rows_priv N
ssl_type
ssl_cipher
x509_issuer
......@@ -1823,6 +1854,7 @@ Create_user_priv N
Event_priv N
Trigger_priv N
Create_tablespace_priv N
Delete_versioning_rows_priv N
ssl_type
ssl_cipher
x509_issuer
......@@ -1869,6 +1901,7 @@ Create_user_priv N
Event_priv N
Trigger_priv N
Create_tablespace_priv N
Delete_versioning_rows_priv N
ssl_type
ssl_cipher
x509_issuer
......
......@@ -604,7 +604,7 @@ trig 1_1-yes
revoke TRIGGER on *.* from test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE, DELETE VERSIONING ROWS ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
disconnect yes_privs;
connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
select current_user;
......@@ -657,7 +657,7 @@ root@localhost
grant TRIGGER on priv_db.* to test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE, DELETE VERSIONING ROWS ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT TRIGGER ON `priv_db`.* TO 'test_yesprivs'@'localhost'
trigger privilege on db level for create:
......@@ -930,7 +930,7 @@ grant TRIGGER on priv1_db.t1 to test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT ON `priv1_db`.* TO 'test_yesprivs'@'localhost'
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, DELETE VERSIONING ROWS ON `priv1_db`.* TO 'test_yesprivs'@'localhost'
GRANT SELECT, UPDATE ON `priv2_db`.* TO 'test_yesprivs'@'localhost'
GRANT TRIGGER ON `priv1_db`.`t1` TO 'test_yesprivs'@'localhost'
......
......@@ -604,7 +604,7 @@ trig 1_1-yes
revoke TRIGGER on *.* from test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE, DELETE VERSIONING ROWS ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
disconnect yes_privs;
connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
select current_user;
......@@ -657,7 +657,7 @@ root@localhost
grant TRIGGER on priv_db.* to test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE, DELETE VERSIONING ROWS ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT TRIGGER ON `priv_db`.* TO 'test_yesprivs'@'localhost'
trigger privilege on db level for create:
......@@ -930,7 +930,7 @@ grant TRIGGER on priv1_db.t1 to test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT ON `priv1_db`.* TO 'test_yesprivs'@'localhost'
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, DELETE VERSIONING ROWS ON `priv1_db`.* TO 'test_yesprivs'@'localhost'
GRANT SELECT, UPDATE ON `priv2_db`.* TO 'test_yesprivs'@'localhost'
GRANT TRIGGER ON `priv1_db`.`t1` TO 'test_yesprivs'@'localhost'
......
......@@ -5,7 +5,7 @@ alter table user drop column default_role;
alter table user drop column max_statement_time;
flush privileges;
create role test_role;
ERROR HY000: Column count of mysql.user is wrong. Expected 44, found 43. Created with MariaDB MYSQL_VERSION_ID, now running MYSQL_VERSION_ID. Please use mysql_upgrade to fix this error
ERROR HY000: Column count of mysql.user is wrong. Expected 45, found 44. Created with MariaDB MYSQL_VERSION_ID, now running MYSQL_VERSION_ID. Please use mysql_upgrade to fix this error
drop role test_role;
ERROR HY000: Operation DROP ROLE failed for 'test_role'
alter table user add column is_role enum('N', 'Y') default 'N' not null
......@@ -15,7 +15,7 @@ create role test_role;
create user test_user@localhost;
grant test_role to test_user@localhost;
set default role test_role for root@localhost;
ERROR HY000: Column count of mysql.user is wrong. Expected 45, found 44. Created with MariaDB MYSQL_VERSION_ID, now running MYSQL_VERSION_ID. Please use mysql_upgrade to fix this error
ERROR HY000: Column count of mysql.user is wrong. Expected 46, found 45. Created with MariaDB MYSQL_VERSION_ID, now running MYSQL_VERSION_ID. Please use mysql_upgrade to fix this error
drop role test_role;
drop user test_user@localhost;
alter table user add column default_role char(80) binary default '' not null
......
......@@ -16,11 +16,11 @@ Host User Role Admin_option
test_role1 test_role2 N
grant select on *.* to test_role2;
select * from mysql.user where user like 'test_role1';
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
test_role1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 N Y 0.000000
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_versioning_rows_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
test_role1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 N Y 0.000000
select * from mysql.user where user like 'test_role2';
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
test_role2 Y N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 N Y 0.000000
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_versioning_rows_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
test_role2 Y N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 N Y 0.000000
select * from mysql.roles_mapping;
ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping'
show grants;
......
......@@ -11,8 +11,8 @@ localhost root test_role1 Y
localhost test_user test_role1 N
grant select on *.* to test_role1;
select * from mysql.user where user='test_role1';
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
test_role1 Y N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 N Y 0.000000
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_versioning_rows_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
test_role1 Y N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 N Y 0.000000
select * from mysql.roles_mapping;
ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping'
show grants;
......
create table t (a int);
truncate t for system_time all;
truncate t to system_time now();
ERROR HY000: System Versioning required: t
create procedure truncate_history_of_t()
begin
prepare stmt from 'truncate t for system_time between \'1-1-1\' and now(6)';
execute stmt;
drop prepare stmt;
end~~
create or replace table t (a int) with system versioning;
insert into t values (1);
update t set a=2;
select * from t for system_time all;
a
2
1
set @test = 'correct';
create trigger trg_before before delete on t for each row set @test = 'incorrect';
create trigger trg_after after delete on t for each row set @test = 'incorrect';
truncate t for system_time all;
select * from t for system_time all;
a
2
truncate t to system_time now(6);
select @test from t;
@test
correct
drop trigger trg_before;
drop trigger trg_after;
update t set a=3;
update t set a=4;
truncate t for system_time as of timestamp now(6);
select * from t for system_time all;
a
4
2
3
truncate t for system_time between '1-1-1' and now(6);
select * from t for system_time all;
a
4
update t set a=5;
truncate t for system_time from '1-1-1' to now(6);
select * from t for system_time all;
a
5
update t set a=6;
call truncate_history_of_t();
select * from t for system_time all;
a
6
set @ts1 = now(6);
update t set a=7;
set @ts2 = now(6);
update t set a=8;
truncate t for system_time from '1-1-1' to @ts1;
select * from t for system_time all;
a
8
7
update t set a=9;
truncate t for system_time between '1-1-1' and @ts2;
select * from t for system_time all;
a
9
8
create or replace table t (a int) with system versioning engine=innodb;
insert into t values (1);
update t set a=2;
select * from t for system_time all;
a
2
1
truncate t for system_time all;
select * from t for system_time all;
a
2
update t set a=3;
update t set a=4;
truncate t for system_time as of timestamp now(6);
select * from t for system_time all;
a
4
2
3
truncate t for system_time between '1-1-1' and now(6);
select * from t for system_time all;
a
4
update t set a=5;
truncate t for system_time from '1-1-1' to now(6);
select * from t for system_time all;
a
5
update t set a=6;
call truncate_history_of_t();
select * from t for system_time all;
a
6
set @ts1 = now(6);
update t set a=7;
set @ts2 = now(6);
update t set a=8;
truncate t for system_time from '1-1-1' to timestamp @ts1;
select * from t for system_time all;
a
8
7
update t set a=9;
truncate t for system_time between '1-1-1' and timestamp @ts2;
select * from t for system_time all;
a
9
8
create or replace table t (a int) with system versioning;
insert into t values (1), (2);
update t set a=11 where a=1;
set @ts1=now(6);
update t set a=22 where a=2;
select * from t for system_time all;
a
11
22
1
2
select * from t for system_time before timestamp @ts1;
a
1
truncate t for system_time before timestamp @ts1;
select * from t for system_time all;
a
11
22
2
truncate t for system_time before timestamp now(6);
select * from t for system_time all;
a
11
22
create or replace table t (a int) with system versioning engine=innodb;
drop table t;
create table t (a int) with system versioning;
insert into t values (1), (2);
update t set a=11 where a=1;
set @ts1=now(6);
......@@ -147,27 +23,15 @@ a
22
1
2
select * from t for system_time before timestamp @ts1;
a
1
insert into t values (33);
select max(sys_trx_start + 0) from t into @tx;
select * from t for system_time before transaction @tx;
a
1
2
truncate t for system_time before timestamp @ts1;
truncate t to system_time timestamp @ts1;
select * from t for system_time all;
a
11
22
2
33
truncate t for system_time before timestamp now(6);
truncate table t to system_time timestamp now(6);
select * from t for system_time all;
a
11
22
33
drop table t;
drop procedure truncate_history_of_t;
connect root,localhost,root,,test;
connection root;
create database mysqltest;
create user mysqltest_1@localhost;
connect user1,localhost,mysqltest_1,,test;
connection user1;
connection root;
create table mysqltest.t (a int) with system versioning;
connection user1;
show grants;
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
truncate mysqltest.t to system_time now();
ERROR 42000: DELETE VERSIONING ROWS command denied to user 'mysqltest_1'@'localhost' for table 't'
connection root;
grant delete versioning rows on mysqltest.* to mysqltest_1@localhost;
grant delete versioning rows on mysqltest.t to mysqltest_1@localhost;
connection user1;
show grants;
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
GRANT DELETE VERSIONING ROWS ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
GRANT DELETE VERSIONING ROWS ON `mysqltest`.`t` TO 'mysqltest_1'@'localhost'
truncate mysqltest.t to system_time now();
connection root;
grant all on *.* to mysqltest_1@localhost;
show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost
GRANT ALL PRIVILEGES ON *.* TO 'mysqltest_1'@'localhost'
GRANT DELETE VERSIONING ROWS ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
GRANT DELETE VERSIONING ROWS ON `mysqltest`.`t` TO 'mysqltest_1'@'localhost'
drop user mysqltest_1@localhost;
drop database mysqltest;
......@@ -58,8 +58,6 @@ show create table t for system_time between timestamp @tm1 and timestamp @tm1;
ERROR HY000: SYSTEM_TIME range selector is prohibited
show create table t for system_time from timestamp @tm1 to timestamp @tm1;
ERROR HY000: SYSTEM_TIME range selector is prohibited
show create table t for system_time before timestamp @tm1;
ERROR HY000: SYSTEM_TIME range selector is prohibited
show create table t for system_time as of timestamp '01-01-1990';
ERROR HY000: VTMD error: failed to query VTMD table
show create table t for system_time as of timestamp '01-01-2020';
......
[innodb]
default-storage-engine=innodb
[myisam]
default-storage-engine=myisam
......@@ -2,120 +2,28 @@
create table t (a int);
--error ER_VERSIONING_REQUIRED
truncate t for system_time all;
delimiter ~~;
create procedure truncate_history_of_t()
begin
prepare stmt from 'truncate t for system_time between \'1-1-1\' and now(6)';
execute stmt;
drop prepare stmt;
end~~
delimiter ;~~
truncate t to system_time now();
# TRUNCATE is not DELETE and trigger must not be called.
create or replace table t (a int) with system versioning;
insert into t values (1);
update t set a=2;
select * from t for system_time all;
set @test = 'correct';
create trigger trg_before before delete on t for each row set @test = 'incorrect';
create trigger trg_after after delete on t for each row set @test = 'incorrect';
truncate t for system_time all;
select * from t for system_time all;
truncate t to system_time now(6);
select @test from t;
drop trigger trg_before;
drop trigger trg_after;
update t set a=3;
update t set a=4;
truncate t for system_time as of timestamp now(6);
select * from t for system_time all;
truncate t for system_time between '1-1-1' and now(6);
select * from t for system_time all;
update t set a=5;
truncate t for system_time from '1-1-1' to now(6);
select * from t for system_time all;
update t set a=6;
call truncate_history_of_t();
select * from t for system_time all;
set @ts1 = now(6);
update t set a=7;
set @ts2 = now(6);
update t set a=8;
truncate t for system_time from '1-1-1' to @ts1;
select * from t for system_time all;
update t set a=9;
truncate t for system_time between '1-1-1' and @ts2;
select * from t for system_time all;
create or replace table t (a int) with system versioning engine=innodb;
insert into t values (1);
update t set a=2;
select * from t for system_time all;
truncate t for system_time all;
select * from t for system_time all;
update t set a=3;
update t set a=4;
truncate t for system_time as of timestamp now(6);
select * from t for system_time all;
truncate t for system_time between '1-1-1' and now(6);
select * from t for system_time all;
update t set a=5;
truncate t for system_time from '1-1-1' to now(6);
select * from t for system_time all;
update t set a=6;
call truncate_history_of_t();
select * from t for system_time all;
set @ts1 = now(6);
update t set a=7;
set @ts2 = now(6);
update t set a=8;
truncate t for system_time from '1-1-1' to timestamp @ts1;
select * from t for system_time all;
update t set a=9;
truncate t for system_time between '1-1-1' and timestamp @ts2;
select * from t for system_time all;
create or replace table t (a int) with system versioning;
insert into t values (1), (2);
update t set a=11 where a=1;
set @ts1=now(6);
update t set a=22 where a=2;
select * from t for system_time all;
select * from t for system_time before timestamp @ts1;
truncate t for system_time before timestamp @ts1;
select * from t for system_time all;
truncate t for system_time before timestamp now(6);
select * from t for system_time all;
drop table t;
create or replace table t (a int) with system versioning engine=innodb;
create table t (a int) with system versioning;
insert into t values (1), (2);
update t set a=11 where a=1;
set @ts1=now(6);
update t set a=22 where a=2;
select * from t for system_time all;
select * from t for system_time before timestamp @ts1;
insert into t values (33);
select max(sys_trx_start + 0) from t into @tx;
select * from t for system_time before transaction @tx;
truncate t for system_time before timestamp @ts1;
truncate t to system_time timestamp @ts1;
select * from t for system_time all;
truncate t for system_time before timestamp now(6);
truncate table t to system_time timestamp now(6);
select * from t for system_time all;
drop table t;
drop procedure truncate_history_of_t;
# Can't test with embedded server
-- source include/not_embedded.inc
--source include/have_innodb.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
connect (root,localhost,root,,test);
connection root;
--disable_warnings
create database mysqltest;
--enable_warnings
create user mysqltest_1@localhost;
connect (user1,localhost,mysqltest_1,,test);
connection user1;
connection root;
create table mysqltest.t (a int) with system versioning;
connection user1;
show grants;
--error ER_TABLEACCESS_DENIED_ERROR
truncate mysqltest.t to system_time now();
connection root;
grant delete versioning rows on mysqltest.* to mysqltest_1@localhost;
grant delete versioning rows on mysqltest.t to mysqltest_1@localhost;
connection user1;
show grants;
truncate mysqltest.t to system_time now();
connection root;
grant all on *.* to mysqltest_1@localhost;
show grants for mysqltest_1@localhost;
drop user mysqltest_1@localhost;
drop database mysqltest;
......@@ -75,8 +75,6 @@ create or replace table t (a int) with system versioning;
show create table t for system_time between timestamp @tm1 and timestamp @tm1;
--error ER_VERS_RANGE_PROHIBITED
show create table t for system_time from timestamp @tm1 to timestamp @tm1;
--error ER_VERS_RANGE_PROHIBITED
show create table t for system_time before timestamp @tm1;
--error ER_VERS_VTMD_ERROR
show create table t for system_time as of timestamp '01-01-1990';
--error ER_VERS_VTMD_ERROR
......
This diff is collapsed.
......@@ -30,8 +30,8 @@ SELECT LOWER( REPLACE((SELECT REPLACE(@@hostname,'_','\_')),'%','\%') )INTO @cur
-- Fill "db" table with default grants for anyone to
-- access database 'test' and 'test_%' if "db" table didn't exist
CREATE TEMPORARY TABLE tmp_db LIKE db;
INSERT INTO tmp_db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y');
INSERT INTO tmp_db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y');
INSERT INTO tmp_db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y','Y');
INSERT INTO tmp_db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y','Y');
INSERT INTO db SELECT * FROM tmp_db WHERE @had_db_table=0;
DROP TABLE tmp_db;
......@@ -42,12 +42,12 @@ CREATE TEMPORARY TABLE tmp_user_nopasswd LIKE user;
CREATE TEMPORARY TABLE tmp_user_socket LIKE user;
CREATE TEMPORARY TABLE tmp_user_anonymous LIKE user;
-- Classic passwordless root account.
INSERT INTO tmp_user_nopasswd VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','','N', 'N','', 0);
REPLACE INTO tmp_user_nopasswd SELECT @current_hostname,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','','N','N','',0 FROM dual WHERE @current_hostname != 'localhost';
REPLACE INTO tmp_user_nopasswd VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','','N','N','',0);
REPLACE INTO tmp_user_nopasswd VALUES ('::1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','','N','N', '', 0);
INSERT INTO tmp_user_nopasswd VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','','N', 'N','', 0);
REPLACE INTO tmp_user_nopasswd SELECT @current_hostname,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','','N','N','',0 FROM dual WHERE @current_hostname != 'localhost';
REPLACE INTO tmp_user_nopasswd VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','','N','N','',0);
REPLACE INTO tmp_user_nopasswd VALUES ('::1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','','N','N', '', 0);
-- More secure root account using unix sucket auth.
INSERT INTO tmp_user_socket VALUES ('localhost',IFNULL(@auth_root_socket, 'root'),'','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'unix_socket','','N', 'N','', 0);
INSERT INTO tmp_user_socket VALUES ('localhost',IFNULL(@auth_root_socket, 'root'),'','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'unix_socket','','N', 'N','', 0);
-- Anonymous user with no privileges.
INSERT INTO tmp_user_anonymous (host,user) VALUES ('localhost','');
INSERT INTO tmp_user_anonymous (host,user) SELECT @current_hostname,'' FROM dual WHERE @current_hostname != 'localhost';
......
......@@ -74,7 +74,7 @@ ALTER TABLE tables_priv
COLLATE utf8_general_ci DEFAULT '' NOT NULL,
MODIFY Table_priv set('Select','Insert','Update','Delete','Create',
'Drop','Grant','References','Index','Alter',
'Create View','Show view','Trigger')
'Create View','Show view','Trigger','Delete versioning rows')
COLLATE utf8_general_ci DEFAULT '' NOT NULL,
COMMENT='Table privileges';
......@@ -729,3 +729,9 @@ ALTER TABLE help_topic MODIFY url TEXT NOT NULL;
# MDEV-7383 - varbinary on mix/max of column_stats
alter table column_stats modify min_value varbinary(255) DEFAULT NULL, modify max_value varbinary(255) DEFAULT NULL;
# System versioning
ALTER TABLE user add Delete_versioning_rows_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL DEFAULT 'N' after Trigger_priv;
ALTER TABLE user modify Delete_versioning_rows_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL DEFAULT 'N';
ALTER TABLE db add Delete_versioning_rows_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL DEFAULT 'N' after Trigger_priv;
ALTER TABLE db modify Delete_versioning_rows_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL DEFAULT 'N';
......@@ -170,6 +170,11 @@ TABLE_FIELD_TYPE mysql_db_table_fields[MYSQL_DB_FIELD_COUNT] = {
{ C_STRING_WITH_LEN("Trigger_priv") },
{ C_STRING_WITH_LEN("enum('N','Y')") },
{ C_STRING_WITH_LEN("utf8") }
},
{
{ C_STRING_WITH_LEN("Delete_versioning_rows_priv") },
{ C_STRING_WITH_LEN("enum('N','Y')") },
{ C_STRING_WITH_LEN("utf8") }
}
};
......@@ -695,9 +700,9 @@ bool ROLE_GRANT_PAIR::init(MEM_ROOT *mem, char *username,
#endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY */
#define NORMAL_HANDSHAKE_SIZE 6
#define ROLE_ASSIGN_COLUMN_IDX 43
#define DEFAULT_ROLE_COLUMN_IDX 44
#define MAX_STATEMENT_TIME_COLUMN_IDX 45
#define ROLE_ASSIGN_COLUMN_IDX 44
#define DEFAULT_ROLE_COLUMN_IDX 45
#define MAX_STATEMENT_TIME_COLUMN_IDX 46
/* various flags valid for ACL_USER */
#define IS_ROLE (1L << 0)
......@@ -2004,6 +2009,9 @@ static bool acl_load(THD *thd, const Grant_tables& tables)
if (user_table.num_fields() <= 38 && (user.access & SUPER_ACL))
user.access|= TRIGGER_ACL;
if (user_table.num_fields() <= 46 && (user.access & DELETE_ACL))
user.access|= DELETE_VERSIONING_ROWS_ACL;
user.sort= get_sort(2, user.host.hostname, user.user.str);
user.hostname_length= safe_strlen(user.host.hostname);
user.user_resource.user_conn= 0;
......@@ -8422,13 +8430,14 @@ static const char *command_array[]=
"ALTER", "SHOW DATABASES", "SUPER", "CREATE TEMPORARY TABLES",
"LOCK TABLES", "EXECUTE", "REPLICATION SLAVE", "REPLICATION CLIENT",
"CREATE VIEW", "SHOW VIEW", "CREATE ROUTINE", "ALTER ROUTINE",
"CREATE USER", "EVENT", "TRIGGER", "CREATE TABLESPACE"
"CREATE USER", "EVENT", "TRIGGER", "CREATE TABLESPACE",
"DELETE VERSIONING ROWS"
};
static uint command_lengths[]=
{
6, 6, 6, 6, 6, 4, 6, 8, 7, 4, 5, 10, 5, 5, 14, 5, 23, 11, 7, 17, 18, 11, 9,
14, 13, 11, 5, 7, 17
14, 13, 11, 5, 7, 17, 22,
};
......
......@@ -50,6 +50,7 @@
#define EVENT_ACL (1UL << 26)
#define TRIGGER_ACL (1UL << 27)
#define CREATE_TABLESPACE_ACL (1UL << 28)
#define DELETE_VERSIONING_ROWS_ACL (1UL << 29)
/*
don't forget to update
1. static struct show_privileges_st sys_privileges[]
......@@ -63,12 +64,13 @@
(UPDATE_ACL | SELECT_ACL | INSERT_ACL | DELETE_ACL | CREATE_ACL | DROP_ACL | \
GRANT_ACL | REFERENCES_ACL | INDEX_ACL | ALTER_ACL | CREATE_TMP_ACL | \
LOCK_TABLES_ACL | EXECUTE_ACL | CREATE_VIEW_ACL | SHOW_VIEW_ACL | \
CREATE_PROC_ACL | ALTER_PROC_ACL | EVENT_ACL | TRIGGER_ACL)
CREATE_PROC_ACL | ALTER_PROC_ACL | EVENT_ACL | TRIGGER_ACL | \
DELETE_VERSIONING_ROWS_ACL)
#define TABLE_ACLS \
(SELECT_ACL | INSERT_ACL | UPDATE_ACL | DELETE_ACL | CREATE_ACL | DROP_ACL | \
GRANT_ACL | REFERENCES_ACL | INDEX_ACL | ALTER_ACL | CREATE_VIEW_ACL | \
SHOW_VIEW_ACL | TRIGGER_ACL)
SHOW_VIEW_ACL | TRIGGER_ACL | DELETE_VERSIONING_ROWS_ACL)
#define COL_ACLS \
(SELECT_ACL | INSERT_ACL | UPDATE_ACL | REFERENCES_ACL)
......@@ -86,7 +88,7 @@
CREATE_TMP_ACL | LOCK_TABLES_ACL | REPL_SLAVE_ACL | REPL_CLIENT_ACL | \
EXECUTE_ACL | CREATE_VIEW_ACL | SHOW_VIEW_ACL | CREATE_PROC_ACL | \
ALTER_PROC_ACL | CREATE_USER_ACL | EVENT_ACL | TRIGGER_ACL | \
CREATE_TABLESPACE_ACL)
CREATE_TABLESPACE_ACL | DELETE_VERSIONING_ROWS_ACL)
#define DEFAULT_CREATE_PROC_ACLS \
(ALTER_PROC_ACL | EXECUTE_ACL)
......@@ -118,31 +120,37 @@
CREATE_PROC_ACL | ALTER_PROC_ACL )
#define DB_CHUNK4 (EXECUTE_ACL)
#define DB_CHUNK5 (EVENT_ACL | TRIGGER_ACL)
#define DB_CHUNK6 (DELETE_VERSIONING_ROWS_ACL)
#define fix_rights_for_db(A) (((A) & DB_CHUNK0) | \
(((A) << 4) & DB_CHUNK1) | \
(((A) << 6) & DB_CHUNK2) | \
(((A) << 9) & DB_CHUNK3) | \
(((A) << 2) & DB_CHUNK4))| \
(((A) << 9) & DB_CHUNK5)
(((A) << 2) & DB_CHUNK4) | \
(((A) << 9) & DB_CHUNK5) | \
(((A) << 10) & DB_CHUNK6))
#define get_rights_for_db(A) (((A) & DB_CHUNK0) | \
(((A) & DB_CHUNK1) >> 4) | \
(((A) & DB_CHUNK2) >> 6) | \
(((A) & DB_CHUNK3) >> 9) | \
(((A) & DB_CHUNK4) >> 2))| \
(((A) & DB_CHUNK5) >> 9)
(((A) & DB_CHUNK4) >> 2) | \
(((A) & DB_CHUNK5) >> 9) | \
(((A) & DB_CHUNK6) >> 10))
#define TBL_CHUNK0 DB_CHUNK0
#define TBL_CHUNK1 DB_CHUNK1
#define TBL_CHUNK2 (CREATE_VIEW_ACL | SHOW_VIEW_ACL)
#define TBL_CHUNK3 TRIGGER_ACL
#define TBL_CHUNK4 (DELETE_VERSIONING_ROWS_ACL)
#define fix_rights_for_table(A) (((A) & TBL_CHUNK0) | \
(((A) << 4) & TBL_CHUNK1) | \
(((A) << 11) & TBL_CHUNK2) | \
(((A) << 15) & TBL_CHUNK3))
(((A) << 15) & TBL_CHUNK3) | \
(((A) << 16) & TBL_CHUNK4))
#define get_rights_for_table(A) (((A) & TBL_CHUNK0) | \
(((A) & TBL_CHUNK1) >> 4) | \
(((A) & TBL_CHUNK2) >> 11) | \
(((A) & TBL_CHUNK3) >> 15))
(((A) & TBL_CHUNK3) >> 15) | \
(((A) & TBL_CHUNK4) >> 16))
#define fix_rights_for_column(A) (((A) & 7) | (((A) & ~7) << 8))
#define get_rights_for_column(A) (((A) & 7) | ((A) >> 8))
#define fix_rights_for_procedure(A) ((((A) << 18) & EXECUTE_ACL) | \
......@@ -176,6 +184,7 @@ enum mysql_db_table_field
MYSQL_DB_FIELD_EXECUTE_PRIV,
MYSQL_DB_FIELD_EVENT_PRIV,
MYSQL_DB_FIELD_TRIGGER_PRIV,
MYSQL_DB_FIELD_DELETE_VERSIONING_ROWS_PRIV,
MYSQL_DB_FIELD_COUNT
};
......
......@@ -275,15 +275,8 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
// trx_sees() in InnoDB reads sys_trx_start
if (!table->versioned_by_sql()) {
if (table_list->vers_conditions.type == FOR_SYSTEM_TIME_BETWEEN ||
table_list->vers_conditions.type == FOR_SYSTEM_TIME_FROM_TO)
{
bitmap_set_bit(table->read_set, table->vers_start_field()->field_index);
}
else if (table_list->vers_conditions.type == FOR_SYSTEM_TIME_BEFORE)
{
bitmap_set_bit(table->read_set, table->vers_end_field()->field_index);
}
DBUG_ASSERT(table_list->vers_conditions.type == FOR_SYSTEM_TIME_BEFORE);
bitmap_set_bit(table->read_set, table->vers_end_field()->field_index);
}
}
......
......@@ -564,6 +564,7 @@ static struct show_privileges_st sys_privileges[]=
{"Create view", "Tables", "To create new views"},
{"Create user", "Server Admin", "To create new users"},
{"Delete", "Tables", "To delete existing rows"},
{"Delete versioning rows", "Tables", "To delete versioning table historical rows"},
{"Drop", "Databases,Tables", "To drop databases, tables, and views"},
#ifdef HAVE_EVENT_SCHEDULER
{"Event","Server Admin","To create, alter, drop and execute events"},
......
......@@ -495,9 +495,12 @@ bool Sql_cmd_truncate_table::execute(THD *thd)
TABLE_LIST *table= thd->lex->select_lex.table_list.first;
DBUG_ENTER("Sql_cmd_truncate_table::execute");
DBUG_ASSERT(table);
if (table->vers_conditions)
{
if (check_one_table_access(thd, DELETE_VERSIONING_ROWS_ACL, table))
DBUG_RETURN(res);
DBUG_RETURN(mysql_delete(thd, table, NULL, NULL, -1, 0, NULL));
}
if (check_one_table_access(thd, DROP_ACL, table))
DBUG_RETURN(res);
......
......@@ -8903,12 +8903,6 @@ system_time_expr:
{
Lex->vers_conditions.init(FOR_SYSTEM_TIME_BETWEEN, $2, $3, $5, $6);
}
| BEFORE_SYM
opt_trans_or_timestamp
simple_expr
{
Lex->vers_conditions.init(FOR_SYSTEM_TIME_BEFORE, $2, $3);
}
;
select_option_list:
......@@ -13025,8 +13019,17 @@ opt_delete_option:
| IGNORE_SYM { Lex->ignore= 1; }
;
truncate_end:
opt_lock_wait_timeout
| TO_SYM SYSTEM_TIME_SYM opt_trans_or_timestamp simple_expr
{
Lex->vers_conditions.init(FOR_SYSTEM_TIME_BEFORE, $3, $4);
Lex->last_table()->vers_conditions= Lex->vers_conditions;
}
;
truncate:
TRUNCATE_SYM opt_table_sym
TRUNCATE_SYM
{
LEX* lex= Lex;
lex->sql_command= SQLCOM_TRUNCATE;
......@@ -13037,15 +13040,13 @@ truncate:
YYPS->m_lock_type= TL_WRITE;
YYPS->m_mdl_type= MDL_EXCLUSIVE;
}
table_name opt_for_system_time_clause opt_lock_wait_timeout
opt_table_sym table_name truncate_end
{
LEX* lex= thd->lex;
DBUG_ASSERT(!lex->m_sql_cmd);
lex->m_sql_cmd= new (thd->mem_root) Sql_cmd_truncate_table();
if (lex->m_sql_cmd == NULL)
MYSQL_YYABORT;
if ($5)
Lex->last_table()->vers_conditions= Lex->vers_conditions;
}
;
......@@ -16076,6 +16077,7 @@ object_privilege:
| EVENT_SYM { Lex->grant |= EVENT_ACL;}
| TRIGGER_SYM { Lex->grant |= TRIGGER_ACL; }
| CREATE TABLESPACE { Lex->grant |= CREATE_TABLESPACE_ACL; }
| DELETE_SYM VERSIONING_SYM ROWS_SYM { Lex->grant |= DELETE_VERSIONING_ROWS_ACL; }
;
opt_and:
......
File mode changed from 100755 to 100644
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment