MDEV-24486 Rename the view sys.table_privileges to sys.privileges_by_table_by_level
This is a follow-up for the initial MDEV-24486 commit. It renames the view sys.table_privileges to sys.privileges_by_table_by_level and adds some more tests displaying privilege levels GLOBAL and SCHEMA
This commit is contained in:
parent
5462b61b0c
commit
70de4075a1
@ -283,6 +283,7 @@ sys.memory_by_user_by_current_bytes OK
|
||||
sys.memory_global_by_current_bytes OK
|
||||
sys.memory_global_total OK
|
||||
sys.metrics OK
|
||||
sys.privileges_by_table_by_level OK
|
||||
sys.processlist OK
|
||||
sys.ps_check_lost_instrumentation OK
|
||||
sys.schema_auto_increment_columns OK
|
||||
@ -302,7 +303,6 @@ sys.statements_with_full_table_scans OK
|
||||
sys.statements_with_runtimes_in_95th_percentile OK
|
||||
sys.statements_with_sorting OK
|
||||
sys.statements_with_temp_tables OK
|
||||
sys.table_privileges OK
|
||||
sys.user_summary OK
|
||||
sys.user_summary_by_file_io OK
|
||||
sys.user_summary_by_file_io_type OK
|
||||
@ -446,6 +446,7 @@ sys.memory_by_user_by_current_bytes OK
|
||||
sys.memory_global_by_current_bytes OK
|
||||
sys.memory_global_total OK
|
||||
sys.metrics OK
|
||||
sys.privileges_by_table_by_level OK
|
||||
sys.processlist OK
|
||||
sys.ps_check_lost_instrumentation OK
|
||||
sys.schema_auto_increment_columns OK
|
||||
@ -465,7 +466,6 @@ sys.statements_with_full_table_scans OK
|
||||
sys.statements_with_runtimes_in_95th_percentile OK
|
||||
sys.statements_with_sorting OK
|
||||
sys.statements_with_temp_tables OK
|
||||
sys.table_privileges OK
|
||||
sys.user_summary OK
|
||||
sys.user_summary_by_file_io OK
|
||||
sys.user_summary_by_file_io_type OK
|
||||
|
@ -140,7 +140,6 @@ TABLES TABLES
|
||||
TABLESPACES TABLESPACES
|
||||
TABLE_CONSTRAINTS TABLE_CONSTRAINTS
|
||||
TABLE_PRIVILEGES TABLE_PRIVILEGES
|
||||
TABLE_PRIVILEGES table_privileges
|
||||
TABLE_STATISTICS TABLE_STATISTICS
|
||||
TRIGGERS TRIGGERS
|
||||
t1 t1
|
||||
@ -164,7 +163,6 @@ TABLES TABLES
|
||||
TABLESPACES TABLESPACES
|
||||
TABLE_CONSTRAINTS TABLE_CONSTRAINTS
|
||||
TABLE_PRIVILEGES TABLE_PRIVILEGES
|
||||
TABLE_PRIVILEGES table_privileges
|
||||
TABLE_STATISTICS TABLE_STATISTICS
|
||||
TRIGGERS TRIGGERS
|
||||
t1 t1
|
||||
@ -188,7 +186,6 @@ TABLES TABLES
|
||||
TABLESPACES TABLESPACES
|
||||
TABLE_CONSTRAINTS TABLE_CONSTRAINTS
|
||||
TABLE_PRIVILEGES TABLE_PRIVILEGES
|
||||
TABLE_PRIVILEGES table_privileges
|
||||
TABLE_STATISTICS TABLE_STATISTICS
|
||||
TRIGGERS TRIGGERS
|
||||
t1 t1
|
||||
@ -1492,6 +1489,7 @@ memory_by_user_by_current_bytes NO
|
||||
memory_global_by_current_bytes YES
|
||||
memory_global_total NO
|
||||
metrics NO
|
||||
privileges_by_table_by_level NO
|
||||
processlist NO
|
||||
ps_check_lost_instrumentation YES
|
||||
schema_auto_increment_columns NO
|
||||
@ -1511,7 +1509,6 @@ statements_with_runtimes_in_95th_percentile YES
|
||||
statements_with_sorting YES
|
||||
statements_with_temp_tables YES
|
||||
statement_analysis YES
|
||||
table_privileges NO
|
||||
user YES
|
||||
user_summary NO
|
||||
user_summary_by_file_io NO
|
||||
|
@ -68,6 +68,7 @@ sys.memory_by_user_by_current_bytes OK
|
||||
sys.memory_global_by_current_bytes OK
|
||||
sys.memory_global_total OK
|
||||
sys.metrics OK
|
||||
sys.privileges_by_table_by_level OK
|
||||
sys.processlist OK
|
||||
sys.ps_check_lost_instrumentation OK
|
||||
sys.schema_auto_increment_columns OK
|
||||
@ -87,7 +88,6 @@ sys.statements_with_full_table_scans OK
|
||||
sys.statements_with_runtimes_in_95th_percentile OK
|
||||
sys.statements_with_sorting OK
|
||||
sys.statements_with_temp_tables OK
|
||||
sys.table_privileges OK
|
||||
sys.user_summary OK
|
||||
sys.user_summary_by_file_io OK
|
||||
sys.user_summary_by_file_io_type OK
|
||||
|
@ -159,6 +159,7 @@ sys.memory_by_user_by_current_bytes OK
|
||||
sys.memory_global_by_current_bytes OK
|
||||
sys.memory_global_total OK
|
||||
sys.metrics OK
|
||||
sys.privileges_by_table_by_level OK
|
||||
sys.processlist OK
|
||||
sys.ps_check_lost_instrumentation OK
|
||||
sys.schema_auto_increment_columns OK
|
||||
@ -178,7 +179,6 @@ sys.statements_with_full_table_scans OK
|
||||
sys.statements_with_runtimes_in_95th_percentile OK
|
||||
sys.statements_with_sorting OK
|
||||
sys.statements_with_temp_tables OK
|
||||
sys.table_privileges OK
|
||||
sys.user_summary OK
|
||||
sys.user_summary_by_file_io OK
|
||||
sys.user_summary_by_file_io_type OK
|
||||
|
@ -79,6 +79,7 @@ sys.memory_by_user_by_current_bytes OK
|
||||
sys.memory_global_by_current_bytes OK
|
||||
sys.memory_global_total OK
|
||||
sys.metrics OK
|
||||
sys.privileges_by_table_by_level OK
|
||||
sys.processlist OK
|
||||
sys.ps_check_lost_instrumentation OK
|
||||
sys.schema_auto_increment_columns OK
|
||||
@ -98,7 +99,6 @@ sys.statements_with_full_table_scans OK
|
||||
sys.statements_with_runtimes_in_95th_percentile OK
|
||||
sys.statements_with_sorting OK
|
||||
sys.statements_with_temp_tables OK
|
||||
sys.table_privileges OK
|
||||
sys.user_summary OK
|
||||
sys.user_summary_by_file_io OK
|
||||
sys.user_summary_by_file_io_type OK
|
||||
|
@ -79,6 +79,7 @@ sys.memory_by_user_by_current_bytes OK
|
||||
sys.memory_global_by_current_bytes OK
|
||||
sys.memory_global_total OK
|
||||
sys.metrics OK
|
||||
sys.privileges_by_table_by_level OK
|
||||
sys.processlist OK
|
||||
sys.ps_check_lost_instrumentation OK
|
||||
sys.schema_auto_increment_columns OK
|
||||
@ -98,7 +99,6 @@ sys.statements_with_full_table_scans OK
|
||||
sys.statements_with_runtimes_in_95th_percentile OK
|
||||
sys.statements_with_sorting OK
|
||||
sys.statements_with_temp_tables OK
|
||||
sys.table_privileges OK
|
||||
sys.user_summary OK
|
||||
sys.user_summary_by_file_io OK
|
||||
sys.user_summary_by_file_io_type OK
|
||||
|
@ -72,6 +72,7 @@ sys.memory_by_user_by_current_bytes OK
|
||||
sys.memory_global_by_current_bytes OK
|
||||
sys.memory_global_total OK
|
||||
sys.metrics OK
|
||||
sys.privileges_by_table_by_level OK
|
||||
sys.processlist OK
|
||||
sys.ps_check_lost_instrumentation OK
|
||||
sys.schema_auto_increment_columns OK
|
||||
@ -91,7 +92,6 @@ sys.statements_with_full_table_scans OK
|
||||
sys.statements_with_runtimes_in_95th_percentile OK
|
||||
sys.statements_with_sorting OK
|
||||
sys.statements_with_temp_tables OK
|
||||
sys.table_privileges OK
|
||||
sys.user_summary OK
|
||||
sys.user_summary_by_file_io OK
|
||||
sys.user_summary_by_file_io_type OK
|
||||
|
@ -130,6 +130,7 @@ sys.memory_by_user_by_current_bytes OK
|
||||
sys.memory_global_by_current_bytes OK
|
||||
sys.memory_global_total OK
|
||||
sys.metrics OK
|
||||
sys.privileges_by_table_by_level OK
|
||||
sys.processlist OK
|
||||
sys.ps_check_lost_instrumentation OK
|
||||
sys.schema_auto_increment_columns OK
|
||||
@ -149,7 +150,6 @@ sys.statements_with_full_table_scans OK
|
||||
sys.statements_with_runtimes_in_95th_percentile OK
|
||||
sys.statements_with_sorting OK
|
||||
sys.statements_with_temp_tables OK
|
||||
sys.table_privileges OK
|
||||
sys.user_summary OK
|
||||
sys.user_summary_by_file_io OK
|
||||
sys.user_summary_by_file_io_type OK
|
||||
@ -395,6 +395,7 @@ sys.memory_by_user_by_current_bytes OK
|
||||
sys.memory_global_by_current_bytes OK
|
||||
sys.memory_global_total OK
|
||||
sys.metrics OK
|
||||
sys.privileges_by_table_by_level OK
|
||||
sys.processlist OK
|
||||
sys.ps_check_lost_instrumentation OK
|
||||
sys.schema_auto_increment_columns OK
|
||||
@ -414,7 +415,6 @@ sys.statements_with_full_table_scans OK
|
||||
sys.statements_with_runtimes_in_95th_percentile OK
|
||||
sys.statements_with_sorting OK
|
||||
sys.statements_with_temp_tables OK
|
||||
sys.table_privileges OK
|
||||
sys.user_summary OK
|
||||
sys.user_summary_by_file_io OK
|
||||
sys.user_summary_by_file_io_type OK
|
||||
|
@ -75,6 +75,7 @@ sys.memory_by_user_by_current_bytes OK
|
||||
sys.memory_global_by_current_bytes OK
|
||||
sys.memory_global_total OK
|
||||
sys.metrics OK
|
||||
sys.privileges_by_table_by_level OK
|
||||
sys.processlist OK
|
||||
sys.ps_check_lost_instrumentation OK
|
||||
sys.schema_auto_increment_columns OK
|
||||
@ -94,7 +95,6 @@ sys.statements_with_full_table_scans OK
|
||||
sys.statements_with_runtimes_in_95th_percentile OK
|
||||
sys.statements_with_sorting OK
|
||||
sys.statements_with_temp_tables OK
|
||||
sys.table_privileges OK
|
||||
sys.user_summary OK
|
||||
sys.user_summary_by_file_io OK
|
||||
sys.user_summary_by_file_io_type OK
|
||||
|
@ -57,6 +57,7 @@ sys.memory_by_user_by_current_bytes OK
|
||||
sys.memory_global_by_current_bytes OK
|
||||
sys.memory_global_total OK
|
||||
sys.metrics OK
|
||||
sys.privileges_by_table_by_level OK
|
||||
sys.processlist OK
|
||||
sys.ps_check_lost_instrumentation OK
|
||||
sys.schema_auto_increment_columns OK
|
||||
@ -76,7 +77,6 @@ sys.statements_with_full_table_scans OK
|
||||
sys.statements_with_runtimes_in_95th_percentile OK
|
||||
sys.statements_with_sorting OK
|
||||
sys.statements_with_temp_tables OK
|
||||
sys.table_privileges OK
|
||||
sys.user_summary OK
|
||||
sys.user_summary_by_file_io OK
|
||||
sys.user_summary_by_file_io_type OK
|
||||
@ -211,6 +211,7 @@ sys.memory_by_user_by_current_bytes OK
|
||||
sys.memory_global_by_current_bytes OK
|
||||
sys.memory_global_total OK
|
||||
sys.metrics OK
|
||||
sys.privileges_by_table_by_level OK
|
||||
sys.processlist OK
|
||||
sys.ps_check_lost_instrumentation OK
|
||||
sys.schema_auto_increment_columns OK
|
||||
@ -230,7 +231,6 @@ sys.statements_with_full_table_scans OK
|
||||
sys.statements_with_runtimes_in_95th_percentile OK
|
||||
sys.statements_with_sorting OK
|
||||
sys.statements_with_temp_tables OK
|
||||
sys.table_privileges OK
|
||||
sys.user_summary OK
|
||||
sys.user_summary_by_file_io OK
|
||||
sys.user_summary_by_file_io_type OK
|
||||
@ -364,6 +364,7 @@ sys.memory_by_user_by_current_bytes OK
|
||||
sys.memory_global_by_current_bytes OK
|
||||
sys.memory_global_total OK
|
||||
sys.metrics OK
|
||||
sys.privileges_by_table_by_level OK
|
||||
sys.processlist OK
|
||||
sys.ps_check_lost_instrumentation OK
|
||||
sys.schema_auto_increment_columns OK
|
||||
@ -383,7 +384,6 @@ sys.statements_with_full_table_scans OK
|
||||
sys.statements_with_runtimes_in_95th_percentile OK
|
||||
sys.statements_with_sorting OK
|
||||
sys.statements_with_temp_tables OK
|
||||
sys.table_privileges OK
|
||||
sys.user_summary OK
|
||||
sys.user_summary_by_file_io OK
|
||||
sys.user_summary_by_file_io_type OK
|
||||
@ -523,6 +523,7 @@ sys.memory_by_user_by_current_bytes OK
|
||||
sys.memory_global_by_current_bytes OK
|
||||
sys.memory_global_total OK
|
||||
sys.metrics OK
|
||||
sys.privileges_by_table_by_level OK
|
||||
sys.processlist OK
|
||||
sys.ps_check_lost_instrumentation OK
|
||||
sys.schema_auto_increment_columns OK
|
||||
@ -542,7 +543,6 @@ sys.statements_with_full_table_scans OK
|
||||
sys.statements_with_runtimes_in_95th_percentile OK
|
||||
sys.statements_with_sorting OK
|
||||
sys.statements_with_temp_tables OK
|
||||
sys.table_privileges OK
|
||||
sys.user_summary OK
|
||||
sys.user_summary_by_file_io OK
|
||||
sys.user_summary_by_file_io_type OK
|
||||
@ -682,6 +682,7 @@ sys.memory_by_user_by_current_bytes OK
|
||||
sys.memory_global_by_current_bytes OK
|
||||
sys.memory_global_total OK
|
||||
sys.metrics OK
|
||||
sys.privileges_by_table_by_level OK
|
||||
sys.processlist OK
|
||||
sys.ps_check_lost_instrumentation OK
|
||||
sys.schema_auto_increment_columns OK
|
||||
@ -701,7 +702,6 @@ sys.statements_with_full_table_scans OK
|
||||
sys.statements_with_runtimes_in_95th_percentile OK
|
||||
sys.statements_with_sorting OK
|
||||
sys.statements_with_temp_tables OK
|
||||
sys.table_privileges OK
|
||||
sys.user_summary OK
|
||||
sys.user_summary_by_file_io OK
|
||||
sys.user_summary_by_file_io_type OK
|
||||
@ -844,6 +844,7 @@ sys.memory_by_user_by_current_bytes OK
|
||||
sys.memory_global_by_current_bytes OK
|
||||
sys.memory_global_total OK
|
||||
sys.metrics OK
|
||||
sys.privileges_by_table_by_level OK
|
||||
sys.processlist OK
|
||||
sys.ps_check_lost_instrumentation OK
|
||||
sys.schema_auto_increment_columns OK
|
||||
@ -863,7 +864,6 @@ sys.statements_with_full_table_scans OK
|
||||
sys.statements_with_runtimes_in_95th_percentile OK
|
||||
sys.statements_with_sorting OK
|
||||
sys.statements_with_temp_tables OK
|
||||
sys.table_privileges OK
|
||||
sys.user_summary OK
|
||||
sys.user_summary_by_file_io OK
|
||||
sys.user_summary_by_file_io_type OK
|
||||
@ -1046,6 +1046,7 @@ sys.memory_by_user_by_current_bytes OK
|
||||
sys.memory_global_by_current_bytes OK
|
||||
sys.memory_global_total OK
|
||||
sys.metrics OK
|
||||
sys.privileges_by_table_by_level OK
|
||||
sys.processlist OK
|
||||
sys.ps_check_lost_instrumentation OK
|
||||
sys.schema_auto_increment_columns OK
|
||||
@ -1065,7 +1066,6 @@ sys.statements_with_full_table_scans OK
|
||||
sys.statements_with_runtimes_in_95th_percentile OK
|
||||
sys.statements_with_sorting OK
|
||||
sys.statements_with_temp_tables OK
|
||||
sys.table_privileges OK
|
||||
sys.user_summary OK
|
||||
sys.user_summary_by_file_io OK
|
||||
sys.user_summary_by_file_io_type OK
|
||||
@ -1219,6 +1219,7 @@ sys.memory_by_user_by_current_bytes OK
|
||||
sys.memory_global_by_current_bytes OK
|
||||
sys.memory_global_total OK
|
||||
sys.metrics OK
|
||||
sys.privileges_by_table_by_level OK
|
||||
sys.processlist OK
|
||||
sys.ps_check_lost_instrumentation OK
|
||||
sys.schema_auto_increment_columns OK
|
||||
@ -1238,7 +1239,6 @@ sys.statements_with_full_table_scans OK
|
||||
sys.statements_with_runtimes_in_95th_percentile OK
|
||||
sys.statements_with_sorting OK
|
||||
sys.statements_with_temp_tables OK
|
||||
sys.table_privileges OK
|
||||
sys.user_summary OK
|
||||
sys.user_summary_by_file_io OK
|
||||
sys.user_summary_by_file_io_type OK
|
||||
@ -1400,6 +1400,7 @@ sys.memory_by_user_by_current_bytes OK
|
||||
sys.memory_global_by_current_bytes OK
|
||||
sys.memory_global_total OK
|
||||
sys.metrics OK
|
||||
sys.privileges_by_table_by_level OK
|
||||
sys.processlist OK
|
||||
sys.ps_check_lost_instrumentation OK
|
||||
sys.schema_auto_increment_columns OK
|
||||
@ -1419,7 +1420,6 @@ sys.statements_with_full_table_scans OK
|
||||
sys.statements_with_runtimes_in_95th_percentile OK
|
||||
sys.statements_with_sorting OK
|
||||
sys.statements_with_temp_tables OK
|
||||
sys.table_privileges OK
|
||||
sys.user_summary OK
|
||||
sys.user_summary_by_file_io OK
|
||||
sys.user_summary_by_file_io_type OK
|
||||
@ -1623,6 +1623,7 @@ sys.memory_by_user_by_current_bytes OK
|
||||
sys.memory_global_by_current_bytes OK
|
||||
sys.memory_global_total OK
|
||||
sys.metrics OK
|
||||
sys.privileges_by_table_by_level OK
|
||||
sys.processlist OK
|
||||
sys.ps_check_lost_instrumentation OK
|
||||
sys.schema_auto_increment_columns OK
|
||||
@ -1642,7 +1643,6 @@ sys.statements_with_full_table_scans OK
|
||||
sys.statements_with_runtimes_in_95th_percentile OK
|
||||
sys.statements_with_sorting OK
|
||||
sys.statements_with_temp_tables OK
|
||||
sys.table_privileges OK
|
||||
sys.user_summary OK
|
||||
sys.user_summary_by_file_io OK
|
||||
sys.user_summary_by_file_io_type OK
|
||||
@ -1804,6 +1804,7 @@ sys.memory_by_user_by_current_bytes OK
|
||||
sys.memory_global_by_current_bytes OK
|
||||
sys.memory_global_total OK
|
||||
sys.metrics OK
|
||||
sys.privileges_by_table_by_level OK
|
||||
sys.processlist OK
|
||||
sys.ps_check_lost_instrumentation OK
|
||||
sys.schema_auto_increment_columns OK
|
||||
@ -1823,7 +1824,6 @@ sys.statements_with_full_table_scans OK
|
||||
sys.statements_with_runtimes_in_95th_percentile OK
|
||||
sys.statements_with_sorting OK
|
||||
sys.statements_with_temp_tables OK
|
||||
sys.table_privileges OK
|
||||
sys.user_summary OK
|
||||
sys.user_summary_by_file_io OK
|
||||
sys.user_summary_by_file_io_type OK
|
||||
@ -2037,6 +2037,7 @@ sys.memory_by_user_by_current_bytes OK
|
||||
sys.memory_global_by_current_bytes OK
|
||||
sys.memory_global_total OK
|
||||
sys.metrics OK
|
||||
sys.privileges_by_table_by_level OK
|
||||
sys.processlist OK
|
||||
sys.ps_check_lost_instrumentation OK
|
||||
sys.schema_auto_increment_columns OK
|
||||
@ -2056,7 +2057,6 @@ sys.statements_with_full_table_scans OK
|
||||
sys.statements_with_runtimes_in_95th_percentile OK
|
||||
sys.statements_with_sorting OK
|
||||
sys.statements_with_temp_tables OK
|
||||
sys.table_privileges OK
|
||||
sys.user_summary OK
|
||||
sys.user_summary_by_file_io OK
|
||||
sys.user_summary_by_file_io_type OK
|
||||
@ -2258,6 +2258,7 @@ sys.memory_by_user_by_current_bytes OK
|
||||
sys.memory_global_by_current_bytes OK
|
||||
sys.memory_global_total OK
|
||||
sys.metrics OK
|
||||
sys.privileges_by_table_by_level OK
|
||||
sys.processlist OK
|
||||
sys.ps_check_lost_instrumentation OK
|
||||
sys.schema_auto_increment_columns OK
|
||||
@ -2277,7 +2278,6 @@ sys.statements_with_full_table_scans OK
|
||||
sys.statements_with_runtimes_in_95th_percentile OK
|
||||
sys.statements_with_sorting OK
|
||||
sys.statements_with_temp_tables OK
|
||||
sys.table_privileges OK
|
||||
sys.user_summary OK
|
||||
sys.user_summary_by_file_io OK
|
||||
sys.user_summary_by_file_io_type OK
|
||||
|
@ -66,6 +66,7 @@ sys.memory_by_user_by_current_bytes OK
|
||||
sys.memory_global_by_current_bytes OK
|
||||
sys.memory_global_total OK
|
||||
sys.metrics OK
|
||||
sys.privileges_by_table_by_level OK
|
||||
sys.processlist OK
|
||||
sys.ps_check_lost_instrumentation OK
|
||||
sys.schema_auto_increment_columns OK
|
||||
@ -85,7 +86,6 @@ sys.statements_with_full_table_scans OK
|
||||
sys.statements_with_runtimes_in_95th_percentile OK
|
||||
sys.statements_with_sorting OK
|
||||
sys.statements_with_temp_tables OK
|
||||
sys.table_privileges OK
|
||||
sys.user_summary OK
|
||||
sys.user_summary_by_file_io OK
|
||||
sys.user_summary_by_file_io_type OK
|
||||
|
@ -57,6 +57,7 @@ sys.memory_by_user_by_current_bytes OK
|
||||
sys.memory_global_by_current_bytes OK
|
||||
sys.memory_global_total OK
|
||||
sys.metrics OK
|
||||
sys.privileges_by_table_by_level OK
|
||||
sys.processlist OK
|
||||
sys.ps_check_lost_instrumentation OK
|
||||
sys.schema_auto_increment_columns OK
|
||||
@ -76,7 +77,6 @@ sys.statements_with_full_table_scans OK
|
||||
sys.statements_with_runtimes_in_95th_percentile OK
|
||||
sys.statements_with_sorting OK
|
||||
sys.statements_with_temp_tables OK
|
||||
sys.table_privileges OK
|
||||
sys.user_summary OK
|
||||
sys.user_summary_by_file_io OK
|
||||
sys.user_summary_by_file_io_type OK
|
||||
|
@ -137,6 +137,7 @@ sys.memory_by_user_by_current_bytes OK
|
||||
sys.memory_global_by_current_bytes OK
|
||||
sys.memory_global_total OK
|
||||
sys.metrics OK
|
||||
sys.privileges_by_table_by_level OK
|
||||
sys.processlist OK
|
||||
sys.ps_check_lost_instrumentation OK
|
||||
sys.schema_auto_increment_columns OK
|
||||
@ -156,7 +157,6 @@ sys.statements_with_full_table_scans OK
|
||||
sys.statements_with_runtimes_in_95th_percentile OK
|
||||
sys.statements_with_sorting OK
|
||||
sys.statements_with_temp_tables OK
|
||||
sys.table_privileges OK
|
||||
sys.user_summary OK
|
||||
sys.user_summary_by_file_io OK
|
||||
sys.user_summary_by_file_io_type OK
|
||||
@ -391,6 +391,7 @@ sys.memory_by_user_by_current_bytes OK
|
||||
sys.memory_global_by_current_bytes OK
|
||||
sys.memory_global_total OK
|
||||
sys.metrics OK
|
||||
sys.privileges_by_table_by_level OK
|
||||
sys.processlist OK
|
||||
sys.ps_check_lost_instrumentation OK
|
||||
sys.schema_auto_increment_columns OK
|
||||
@ -410,7 +411,6 @@ sys.statements_with_full_table_scans OK
|
||||
sys.statements_with_runtimes_in_95th_percentile OK
|
||||
sys.statements_with_sorting OK
|
||||
sys.statements_with_temp_tables OK
|
||||
sys.table_privileges OK
|
||||
sys.user_summary OK
|
||||
sys.user_summary_by_file_io OK
|
||||
sys.user_summary_by_file_io_type OK
|
||||
@ -620,6 +620,7 @@ sys.memory_by_user_by_current_bytes OK
|
||||
sys.memory_global_by_current_bytes OK
|
||||
sys.memory_global_total OK
|
||||
sys.metrics OK
|
||||
sys.privileges_by_table_by_level OK
|
||||
sys.processlist OK
|
||||
sys.ps_check_lost_instrumentation OK
|
||||
sys.schema_auto_increment_columns OK
|
||||
@ -639,7 +640,6 @@ sys.statements_with_full_table_scans OK
|
||||
sys.statements_with_runtimes_in_95th_percentile OK
|
||||
sys.statements_with_sorting OK
|
||||
sys.statements_with_temp_tables OK
|
||||
sys.table_privileges OK
|
||||
sys.user_summary OK
|
||||
sys.user_summary_by_file_io OK
|
||||
sys.user_summary_by_file_io_type OK
|
||||
|
@ -160,6 +160,7 @@ sys.memory_by_user_by_current_bytes OK
|
||||
sys.memory_global_by_current_bytes OK
|
||||
sys.memory_global_total OK
|
||||
sys.metrics OK
|
||||
sys.privileges_by_table_by_level OK
|
||||
sys.processlist OK
|
||||
sys.ps_check_lost_instrumentation OK
|
||||
sys.schema_auto_increment_columns OK
|
||||
@ -179,7 +180,6 @@ sys.statements_with_full_table_scans OK
|
||||
sys.statements_with_runtimes_in_95th_percentile OK
|
||||
sys.statements_with_sorting OK
|
||||
sys.statements_with_temp_tables OK
|
||||
sys.table_privileges OK
|
||||
sys.user_summary OK
|
||||
sys.user_summary_by_file_io OK
|
||||
sys.user_summary_by_file_io_type OK
|
||||
|
@ -178,6 +178,7 @@ sys.memory_by_user_by_current_bytes OK
|
||||
sys.memory_global_by_current_bytes OK
|
||||
sys.memory_global_total OK
|
||||
sys.metrics OK
|
||||
sys.privileges_by_table_by_level OK
|
||||
sys.processlist OK
|
||||
sys.ps_check_lost_instrumentation OK
|
||||
sys.schema_auto_increment_columns OK
|
||||
@ -197,7 +198,6 @@ sys.statements_with_full_table_scans OK
|
||||
sys.statements_with_runtimes_in_95th_percentile OK
|
||||
sys.statements_with_sorting OK
|
||||
sys.statements_with_temp_tables OK
|
||||
sys.table_privileges OK
|
||||
sys.user_summary OK
|
||||
sys.user_summary_by_file_io OK
|
||||
sys.user_summary_by_file_io_type OK
|
||||
@ -381,6 +381,7 @@ sys.memory_by_user_by_current_bytes OK
|
||||
sys.memory_global_by_current_bytes OK
|
||||
sys.memory_global_total OK
|
||||
sys.metrics OK
|
||||
sys.privileges_by_table_by_level OK
|
||||
sys.processlist OK
|
||||
sys.ps_check_lost_instrumentation OK
|
||||
sys.schema_auto_increment_columns OK
|
||||
@ -400,7 +401,6 @@ sys.statements_with_full_table_scans OK
|
||||
sys.statements_with_runtimes_in_95th_percentile OK
|
||||
sys.statements_with_sorting OK
|
||||
sys.statements_with_temp_tables OK
|
||||
sys.table_privileges OK
|
||||
sys.user_summary OK
|
||||
sys.user_summary_by_file_io OK
|
||||
sys.user_summary_by_file_io_type OK
|
||||
|
@ -162,6 +162,7 @@ sys.memory_by_user_by_current_bytes OK
|
||||
sys.memory_global_by_current_bytes OK
|
||||
sys.memory_global_total OK
|
||||
sys.metrics OK
|
||||
sys.privileges_by_table_by_level OK
|
||||
sys.processlist OK
|
||||
sys.ps_check_lost_instrumentation OK
|
||||
sys.schema_auto_increment_columns OK
|
||||
@ -181,7 +182,6 @@ sys.statements_with_full_table_scans OK
|
||||
sys.statements_with_runtimes_in_95th_percentile OK
|
||||
sys.statements_with_sorting OK
|
||||
sys.statements_with_temp_tables OK
|
||||
sys.table_privileges OK
|
||||
sys.user_summary OK
|
||||
sys.user_summary_by_file_io OK
|
||||
sys.user_summary_by_file_io_type OK
|
||||
@ -357,6 +357,7 @@ sys.memory_by_user_by_current_bytes OK
|
||||
sys.memory_global_by_current_bytes OK
|
||||
sys.memory_global_total OK
|
||||
sys.metrics OK
|
||||
sys.privileges_by_table_by_level OK
|
||||
sys.processlist OK
|
||||
sys.ps_check_lost_instrumentation OK
|
||||
sys.schema_auto_increment_columns OK
|
||||
@ -376,7 +377,6 @@ sys.statements_with_full_table_scans OK
|
||||
sys.statements_with_runtimes_in_95th_percentile OK
|
||||
sys.statements_with_sorting OK
|
||||
sys.statements_with_temp_tables OK
|
||||
sys.table_privileges OK
|
||||
sys.user_summary OK
|
||||
sys.user_summary_by_file_io OK
|
||||
sys.user_summary_by_file_io_type OK
|
||||
|
@ -108,6 +108,7 @@ sys.memory_by_user_by_current_bytes OK
|
||||
sys.memory_global_by_current_bytes OK
|
||||
sys.memory_global_total OK
|
||||
sys.metrics OK
|
||||
sys.privileges_by_table_by_level OK
|
||||
sys.processlist OK
|
||||
sys.ps_check_lost_instrumentation OK
|
||||
sys.schema_auto_increment_columns OK
|
||||
@ -127,7 +128,6 @@ sys.statements_with_full_table_scans OK
|
||||
sys.statements_with_runtimes_in_95th_percentile OK
|
||||
sys.statements_with_sorting OK
|
||||
sys.statements_with_temp_tables OK
|
||||
sys.table_privileges OK
|
||||
sys.user_summary OK
|
||||
sys.user_summary_by_file_io OK
|
||||
sys.user_summary_by_file_io_type OK
|
||||
|
@ -122,6 +122,7 @@ sys.memory_by_user_by_current_bytes OK
|
||||
sys.memory_global_by_current_bytes OK
|
||||
sys.memory_global_total OK
|
||||
sys.metrics OK
|
||||
sys.privileges_by_table_by_level OK
|
||||
sys.processlist OK
|
||||
sys.ps_check_lost_instrumentation OK
|
||||
sys.schema_auto_increment_columns OK
|
||||
@ -141,7 +142,6 @@ sys.statements_with_full_table_scans OK
|
||||
sys.statements_with_runtimes_in_95th_percentile OK
|
||||
sys.statements_with_sorting OK
|
||||
sys.statements_with_temp_tables OK
|
||||
sys.table_privileges OK
|
||||
sys.user_summary OK
|
||||
sys.user_summary_by_file_io OK
|
||||
sys.user_summary_by_file_io_type OK
|
||||
|
@ -22,6 +22,7 @@ memory_by_user_by_current_bytes
|
||||
memory_global_by_current_bytes
|
||||
memory_global_total
|
||||
metrics
|
||||
privileges_by_table_by_level
|
||||
processlist
|
||||
ps_check_lost_instrumentation
|
||||
schema_auto_increment_columns
|
||||
@ -42,7 +43,6 @@ statements_with_sorting
|
||||
statements_with_temp_tables
|
||||
statement_analysis
|
||||
sys_config
|
||||
table_privileges
|
||||
user_summary
|
||||
user_summary_by_file_io
|
||||
user_summary_by_file_io_type
|
||||
|
@ -0,0 +1,264 @@
|
||||
DESC sys.privileges_by_table_by_level;
|
||||
Field Type Null Key Default Extra
|
||||
TABLE_SCHEMA varchar(64) NO NULL
|
||||
TABLE_NAME varchar(64) NO NULL
|
||||
GRANTEE varchar(385) NO
|
||||
PRIVILEGE varchar(64) NO
|
||||
LEVEL varchar(6) NO
|
||||
CREATE DATABASE test1;
|
||||
USE test1;
|
||||
CREATE TABLE t1 (a int);
|
||||
CREATE USER test1_user;
|
||||
GRANT ALL PRIVILEGES ON test1.* TO test1_user;
|
||||
# Grant all table privileges
|
||||
GRANT ALL ON t1 to test1_user;
|
||||
SELECT table_schema, table_name,
|
||||
CASE WHEN grantee LIKE '\'root%' THEN '<some-root-user>' ELSE GRANTEE END,
|
||||
privilege, level
|
||||
FROM sys.privileges_by_table_by_level WHERE table_name='t1';
|
||||
table_schema table_name CASE WHEN grantee LIKE '\'root%' THEN '<some-root-user>' ELSE GRANTEE END privilege level
|
||||
test1 t1 <some-root-user> SELECT GLOBAL
|
||||
test1 t1 <some-root-user> INSERT GLOBAL
|
||||
test1 t1 <some-root-user> UPDATE GLOBAL
|
||||
test1 t1 <some-root-user> DELETE GLOBAL
|
||||
test1 t1 <some-root-user> CREATE GLOBAL
|
||||
test1 t1 <some-root-user> DROP GLOBAL
|
||||
test1 t1 <some-root-user> REFERENCES GLOBAL
|
||||
test1 t1 <some-root-user> INDEX GLOBAL
|
||||
test1 t1 <some-root-user> ALTER GLOBAL
|
||||
test1 t1 <some-root-user> SHOW VIEW GLOBAL
|
||||
test1 t1 <some-root-user> TRIGGER GLOBAL
|
||||
test1 t1 <some-root-user> DELETE HISTORY GLOBAL
|
||||
test1 t1 <some-root-user> SELECT GLOBAL
|
||||
test1 t1 <some-root-user> INSERT GLOBAL
|
||||
test1 t1 <some-root-user> UPDATE GLOBAL
|
||||
test1 t1 <some-root-user> DELETE GLOBAL
|
||||
test1 t1 <some-root-user> CREATE GLOBAL
|
||||
test1 t1 <some-root-user> DROP GLOBAL
|
||||
test1 t1 <some-root-user> REFERENCES GLOBAL
|
||||
test1 t1 <some-root-user> INDEX GLOBAL
|
||||
test1 t1 <some-root-user> ALTER GLOBAL
|
||||
test1 t1 <some-root-user> SHOW VIEW GLOBAL
|
||||
test1 t1 <some-root-user> TRIGGER GLOBAL
|
||||
test1 t1 <some-root-user> DELETE HISTORY GLOBAL
|
||||
test1 t1 <some-root-user> SELECT GLOBAL
|
||||
test1 t1 <some-root-user> INSERT GLOBAL
|
||||
test1 t1 <some-root-user> UPDATE GLOBAL
|
||||
test1 t1 <some-root-user> DELETE GLOBAL
|
||||
test1 t1 <some-root-user> CREATE GLOBAL
|
||||
test1 t1 <some-root-user> DROP GLOBAL
|
||||
test1 t1 <some-root-user> REFERENCES GLOBAL
|
||||
test1 t1 <some-root-user> INDEX GLOBAL
|
||||
test1 t1 <some-root-user> ALTER GLOBAL
|
||||
test1 t1 <some-root-user> SHOW VIEW GLOBAL
|
||||
test1 t1 <some-root-user> TRIGGER GLOBAL
|
||||
test1 t1 <some-root-user> DELETE HISTORY GLOBAL
|
||||
test1 t1 <some-root-user> SELECT GLOBAL
|
||||
test1 t1 <some-root-user> INSERT GLOBAL
|
||||
test1 t1 <some-root-user> UPDATE GLOBAL
|
||||
test1 t1 <some-root-user> DELETE GLOBAL
|
||||
test1 t1 <some-root-user> CREATE GLOBAL
|
||||
test1 t1 <some-root-user> DROP GLOBAL
|
||||
test1 t1 <some-root-user> REFERENCES GLOBAL
|
||||
test1 t1 <some-root-user> INDEX GLOBAL
|
||||
test1 t1 <some-root-user> ALTER GLOBAL
|
||||
test1 t1 <some-root-user> SHOW VIEW GLOBAL
|
||||
test1 t1 <some-root-user> TRIGGER GLOBAL
|
||||
test1 t1 <some-root-user> DELETE HISTORY GLOBAL
|
||||
test1 t1 'test1_user'@'%' SELECT SCHEMA
|
||||
test1 t1 'test1_user'@'%' INSERT SCHEMA
|
||||
test1 t1 'test1_user'@'%' UPDATE SCHEMA
|
||||
test1 t1 'test1_user'@'%' DELETE SCHEMA
|
||||
test1 t1 'test1_user'@'%' CREATE SCHEMA
|
||||
test1 t1 'test1_user'@'%' DROP SCHEMA
|
||||
test1 t1 'test1_user'@'%' REFERENCES SCHEMA
|
||||
test1 t1 'test1_user'@'%' INDEX SCHEMA
|
||||
test1 t1 'test1_user'@'%' ALTER SCHEMA
|
||||
test1 t1 'test1_user'@'%' SHOW VIEW SCHEMA
|
||||
test1 t1 'test1_user'@'%' TRIGGER SCHEMA
|
||||
test1 t1 'test1_user'@'%' DELETE HISTORY SCHEMA
|
||||
test1 t1 'test1_user'@'%' SELECT TABLE
|
||||
test1 t1 'test1_user'@'%' INSERT TABLE
|
||||
test1 t1 'test1_user'@'%' UPDATE TABLE
|
||||
test1 t1 'test1_user'@'%' DELETE TABLE
|
||||
test1 t1 'test1_user'@'%' CREATE TABLE
|
||||
test1 t1 'test1_user'@'%' DROP TABLE
|
||||
test1 t1 'test1_user'@'%' REFERENCES TABLE
|
||||
test1 t1 'test1_user'@'%' INDEX TABLE
|
||||
test1 t1 'test1_user'@'%' ALTER TABLE
|
||||
test1 t1 'test1_user'@'%' SHOW VIEW TABLE
|
||||
test1 t1 'test1_user'@'%' TRIGGER TABLE
|
||||
test1 t1 'test1_user'@'%' DELETE HISTORY TABLE
|
||||
# Revoke some table privileges
|
||||
REVOKE REFERENCES, DELETE, ALTER, DROP ON t1 FROM test1_user;
|
||||
SELECT table_schema, table_name,
|
||||
CASE WHEN grantee LIKE '\'root%' THEN '<some-root-user>' ELSE GRANTEE END,
|
||||
privilege, level
|
||||
FROM sys.privileges_by_table_by_level WHERE table_name='t1';
|
||||
table_schema table_name CASE WHEN grantee LIKE '\'root%' THEN '<some-root-user>' ELSE GRANTEE END privilege level
|
||||
test1 t1 <some-root-user> SELECT GLOBAL
|
||||
test1 t1 <some-root-user> INSERT GLOBAL
|
||||
test1 t1 <some-root-user> UPDATE GLOBAL
|
||||
test1 t1 <some-root-user> DELETE GLOBAL
|
||||
test1 t1 <some-root-user> CREATE GLOBAL
|
||||
test1 t1 <some-root-user> DROP GLOBAL
|
||||
test1 t1 <some-root-user> REFERENCES GLOBAL
|
||||
test1 t1 <some-root-user> INDEX GLOBAL
|
||||
test1 t1 <some-root-user> ALTER GLOBAL
|
||||
test1 t1 <some-root-user> SHOW VIEW GLOBAL
|
||||
test1 t1 <some-root-user> TRIGGER GLOBAL
|
||||
test1 t1 <some-root-user> DELETE HISTORY GLOBAL
|
||||
test1 t1 <some-root-user> SELECT GLOBAL
|
||||
test1 t1 <some-root-user> INSERT GLOBAL
|
||||
test1 t1 <some-root-user> UPDATE GLOBAL
|
||||
test1 t1 <some-root-user> DELETE GLOBAL
|
||||
test1 t1 <some-root-user> CREATE GLOBAL
|
||||
test1 t1 <some-root-user> DROP GLOBAL
|
||||
test1 t1 <some-root-user> REFERENCES GLOBAL
|
||||
test1 t1 <some-root-user> INDEX GLOBAL
|
||||
test1 t1 <some-root-user> ALTER GLOBAL
|
||||
test1 t1 <some-root-user> SHOW VIEW GLOBAL
|
||||
test1 t1 <some-root-user> TRIGGER GLOBAL
|
||||
test1 t1 <some-root-user> DELETE HISTORY GLOBAL
|
||||
test1 t1 <some-root-user> SELECT GLOBAL
|
||||
test1 t1 <some-root-user> INSERT GLOBAL
|
||||
test1 t1 <some-root-user> UPDATE GLOBAL
|
||||
test1 t1 <some-root-user> DELETE GLOBAL
|
||||
test1 t1 <some-root-user> CREATE GLOBAL
|
||||
test1 t1 <some-root-user> DROP GLOBAL
|
||||
test1 t1 <some-root-user> REFERENCES GLOBAL
|
||||
test1 t1 <some-root-user> INDEX GLOBAL
|
||||
test1 t1 <some-root-user> ALTER GLOBAL
|
||||
test1 t1 <some-root-user> SHOW VIEW GLOBAL
|
||||
test1 t1 <some-root-user> TRIGGER GLOBAL
|
||||
test1 t1 <some-root-user> DELETE HISTORY GLOBAL
|
||||
test1 t1 <some-root-user> SELECT GLOBAL
|
||||
test1 t1 <some-root-user> INSERT GLOBAL
|
||||
test1 t1 <some-root-user> UPDATE GLOBAL
|
||||
test1 t1 <some-root-user> DELETE GLOBAL
|
||||
test1 t1 <some-root-user> CREATE GLOBAL
|
||||
test1 t1 <some-root-user> DROP GLOBAL
|
||||
test1 t1 <some-root-user> REFERENCES GLOBAL
|
||||
test1 t1 <some-root-user> INDEX GLOBAL
|
||||
test1 t1 <some-root-user> ALTER GLOBAL
|
||||
test1 t1 <some-root-user> SHOW VIEW GLOBAL
|
||||
test1 t1 <some-root-user> TRIGGER GLOBAL
|
||||
test1 t1 <some-root-user> DELETE HISTORY GLOBAL
|
||||
test1 t1 'test1_user'@'%' SELECT SCHEMA
|
||||
test1 t1 'test1_user'@'%' INSERT SCHEMA
|
||||
test1 t1 'test1_user'@'%' UPDATE SCHEMA
|
||||
test1 t1 'test1_user'@'%' DELETE SCHEMA
|
||||
test1 t1 'test1_user'@'%' CREATE SCHEMA
|
||||
test1 t1 'test1_user'@'%' DROP SCHEMA
|
||||
test1 t1 'test1_user'@'%' REFERENCES SCHEMA
|
||||
test1 t1 'test1_user'@'%' INDEX SCHEMA
|
||||
test1 t1 'test1_user'@'%' ALTER SCHEMA
|
||||
test1 t1 'test1_user'@'%' SHOW VIEW SCHEMA
|
||||
test1 t1 'test1_user'@'%' TRIGGER SCHEMA
|
||||
test1 t1 'test1_user'@'%' DELETE HISTORY SCHEMA
|
||||
test1 t1 'test1_user'@'%' SELECT TABLE
|
||||
test1 t1 'test1_user'@'%' INSERT TABLE
|
||||
test1 t1 'test1_user'@'%' UPDATE TABLE
|
||||
test1 t1 'test1_user'@'%' CREATE TABLE
|
||||
test1 t1 'test1_user'@'%' INDEX TABLE
|
||||
test1 t1 'test1_user'@'%' SHOW VIEW TABLE
|
||||
test1 t1 'test1_user'@'%' TRIGGER TABLE
|
||||
test1 t1 'test1_user'@'%' DELETE HISTORY TABLE
|
||||
CREATE ROLE test1_role;
|
||||
GRANT SELECT, UPDATE, DELETE, DROP, INDEX ON t1 to test1_role;
|
||||
# Must show both the user and the role
|
||||
SELECT * FROM sys.privileges_by_table_by_level
|
||||
WHERE table_schema='test1' AND table_name='t1' AND grantee LIKE '%test1%';
|
||||
TABLE_SCHEMA TABLE_NAME GRANTEE PRIVILEGE LEVEL
|
||||
test1 t1 'test1_user'@'%' SELECT SCHEMA
|
||||
test1 t1 'test1_user'@'%' INSERT SCHEMA
|
||||
test1 t1 'test1_user'@'%' UPDATE SCHEMA
|
||||
test1 t1 'test1_user'@'%' DELETE SCHEMA
|
||||
test1 t1 'test1_user'@'%' CREATE SCHEMA
|
||||
test1 t1 'test1_user'@'%' DROP SCHEMA
|
||||
test1 t1 'test1_user'@'%' REFERENCES SCHEMA
|
||||
test1 t1 'test1_user'@'%' INDEX SCHEMA
|
||||
test1 t1 'test1_user'@'%' ALTER SCHEMA
|
||||
test1 t1 'test1_user'@'%' SHOW VIEW SCHEMA
|
||||
test1 t1 'test1_user'@'%' TRIGGER SCHEMA
|
||||
test1 t1 'test1_user'@'%' DELETE HISTORY SCHEMA
|
||||
test1 t1 'test1_user'@'%' SELECT TABLE
|
||||
test1 t1 'test1_user'@'%' INSERT TABLE
|
||||
test1 t1 'test1_user'@'%' UPDATE TABLE
|
||||
test1 t1 'test1_user'@'%' CREATE TABLE
|
||||
test1 t1 'test1_user'@'%' INDEX TABLE
|
||||
test1 t1 'test1_user'@'%' SHOW VIEW TABLE
|
||||
test1 t1 'test1_user'@'%' TRIGGER TABLE
|
||||
test1 t1 'test1_user'@'%' DELETE HISTORY TABLE
|
||||
test1 t1 'test1_role'@'' SELECT TABLE
|
||||
test1 t1 'test1_role'@'' UPDATE TABLE
|
||||
test1 t1 'test1_role'@'' DELETE TABLE
|
||||
test1 t1 'test1_role'@'' DROP TABLE
|
||||
test1 t1 'test1_role'@'' INDEX TABLE
|
||||
CREATE VIEW v1 AS SELECT * FROM t1;
|
||||
SELECT * FROM sys.privileges_by_table_by_level
|
||||
WHERE table_schema='test1' AND table_name='v1' AND grantee LIKE '%test1%';
|
||||
TABLE_SCHEMA TABLE_NAME GRANTEE PRIVILEGE LEVEL
|
||||
test1 v1 'test1_user'@'%' SELECT SCHEMA
|
||||
test1 v1 'test1_user'@'%' INSERT SCHEMA
|
||||
test1 v1 'test1_user'@'%' UPDATE SCHEMA
|
||||
test1 v1 'test1_user'@'%' DELETE SCHEMA
|
||||
test1 v1 'test1_user'@'%' CREATE SCHEMA
|
||||
test1 v1 'test1_user'@'%' DROP SCHEMA
|
||||
test1 v1 'test1_user'@'%' REFERENCES SCHEMA
|
||||
test1 v1 'test1_user'@'%' INDEX SCHEMA
|
||||
test1 v1 'test1_user'@'%' ALTER SCHEMA
|
||||
test1 v1 'test1_user'@'%' SHOW VIEW SCHEMA
|
||||
test1 v1 'test1_user'@'%' TRIGGER SCHEMA
|
||||
test1 v1 'test1_user'@'%' DELETE HISTORY SCHEMA
|
||||
GRANT SELECT ON v1 TO test1_role;
|
||||
SELECT * FROM sys.privileges_by_table_by_level
|
||||
WHERE table_schema='test1' AND table_name='v1' AND grantee LIKE '%test1%';
|
||||
TABLE_SCHEMA TABLE_NAME GRANTEE PRIVILEGE LEVEL
|
||||
test1 v1 'test1_user'@'%' SELECT SCHEMA
|
||||
test1 v1 'test1_user'@'%' INSERT SCHEMA
|
||||
test1 v1 'test1_user'@'%' UPDATE SCHEMA
|
||||
test1 v1 'test1_user'@'%' DELETE SCHEMA
|
||||
test1 v1 'test1_user'@'%' CREATE SCHEMA
|
||||
test1 v1 'test1_user'@'%' DROP SCHEMA
|
||||
test1 v1 'test1_user'@'%' REFERENCES SCHEMA
|
||||
test1 v1 'test1_user'@'%' INDEX SCHEMA
|
||||
test1 v1 'test1_user'@'%' ALTER SCHEMA
|
||||
test1 v1 'test1_user'@'%' SHOW VIEW SCHEMA
|
||||
test1 v1 'test1_user'@'%' TRIGGER SCHEMA
|
||||
test1 v1 'test1_user'@'%' DELETE HISTORY SCHEMA
|
||||
test1 v1 'test1_role'@'' SELECT TABLE
|
||||
GRANT ALL ON v1 TO test1_user;
|
||||
SELECT * FROM sys.privileges_by_table_by_level
|
||||
WHERE table_schema='test1' AND table_name='v1' AND grantee LIKE '%test1%';
|
||||
TABLE_SCHEMA TABLE_NAME GRANTEE PRIVILEGE LEVEL
|
||||
test1 v1 'test1_user'@'%' SELECT SCHEMA
|
||||
test1 v1 'test1_user'@'%' INSERT SCHEMA
|
||||
test1 v1 'test1_user'@'%' UPDATE SCHEMA
|
||||
test1 v1 'test1_user'@'%' DELETE SCHEMA
|
||||
test1 v1 'test1_user'@'%' CREATE SCHEMA
|
||||
test1 v1 'test1_user'@'%' DROP SCHEMA
|
||||
test1 v1 'test1_user'@'%' REFERENCES SCHEMA
|
||||
test1 v1 'test1_user'@'%' INDEX SCHEMA
|
||||
test1 v1 'test1_user'@'%' ALTER SCHEMA
|
||||
test1 v1 'test1_user'@'%' SHOW VIEW SCHEMA
|
||||
test1 v1 'test1_user'@'%' TRIGGER SCHEMA
|
||||
test1 v1 'test1_user'@'%' DELETE HISTORY SCHEMA
|
||||
test1 v1 'test1_user'@'%' SELECT TABLE
|
||||
test1 v1 'test1_user'@'%' INSERT TABLE
|
||||
test1 v1 'test1_user'@'%' UPDATE TABLE
|
||||
test1 v1 'test1_user'@'%' DELETE TABLE
|
||||
test1 v1 'test1_user'@'%' CREATE TABLE
|
||||
test1 v1 'test1_user'@'%' DROP TABLE
|
||||
test1 v1 'test1_user'@'%' REFERENCES TABLE
|
||||
test1 v1 'test1_user'@'%' INDEX TABLE
|
||||
test1 v1 'test1_user'@'%' ALTER TABLE
|
||||
test1 v1 'test1_user'@'%' SHOW VIEW TABLE
|
||||
test1 v1 'test1_user'@'%' TRIGGER TABLE
|
||||
test1 v1 'test1_user'@'%' DELETE HISTORY TABLE
|
||||
test1 v1 'test1_role'@'' SELECT TABLE
|
||||
DROP TABLE t1;
|
||||
DROP VIEW v1;
|
||||
DROP USER test1_user;
|
||||
DROP ROLE test1_role;
|
||||
DROP DATABASE test1;
|
@ -1,92 +0,0 @@
|
||||
DESC sys.table_privileges;
|
||||
Field Type Null Key Default Extra
|
||||
TABLE_SCHEMA varchar(64) NO NULL
|
||||
TABLE_NAME varchar(64) NO NULL
|
||||
GRANTEE varchar(385) NO
|
||||
PRIVILEGE varchar(64) NO
|
||||
LEVEL varchar(6) NO
|
||||
SELECT * FROM sys.table_privileges;
|
||||
CREATE DATABASE test2;
|
||||
USE test2;
|
||||
CREATE TABLE t1 (a int);
|
||||
CREATE USER test2_user;
|
||||
# Grant everything first
|
||||
GRANT ALL ON t1 TO test2_user;
|
||||
SELECT * FROM sys.table_privileges WHERE table_schema='test2' AND table_name='t1'
|
||||
AND grantee LIKE '%test2_user%';
|
||||
TABLE_SCHEMA TABLE_NAME GRANTEE PRIVILEGE LEVEL
|
||||
test2 t1 'test2_user'@'%' SELECT TABLE
|
||||
test2 t1 'test2_user'@'%' INSERT TABLE
|
||||
test2 t1 'test2_user'@'%' UPDATE TABLE
|
||||
test2 t1 'test2_user'@'%' DELETE TABLE
|
||||
test2 t1 'test2_user'@'%' CREATE TABLE
|
||||
test2 t1 'test2_user'@'%' DROP TABLE
|
||||
test2 t1 'test2_user'@'%' REFERENCES TABLE
|
||||
test2 t1 'test2_user'@'%' INDEX TABLE
|
||||
test2 t1 'test2_user'@'%' ALTER TABLE
|
||||
test2 t1 'test2_user'@'%' SHOW VIEW TABLE
|
||||
test2 t1 'test2_user'@'%' TRIGGER TABLE
|
||||
test2 t1 'test2_user'@'%' DELETE HISTORY TABLE
|
||||
# Then revoke some privileges
|
||||
REVOKE REFERENCES, DELETE, ALTER, DROP ON t1 FROM test2_user;
|
||||
SELECT * FROM sys.table_privileges WHERE table_schema='test2' AND table_name='t1'
|
||||
AND grantee LIKE '%test2_user%';
|
||||
TABLE_SCHEMA TABLE_NAME GRANTEE PRIVILEGE LEVEL
|
||||
test2 t1 'test2_user'@'%' SELECT TABLE
|
||||
test2 t1 'test2_user'@'%' INSERT TABLE
|
||||
test2 t1 'test2_user'@'%' UPDATE TABLE
|
||||
test2 t1 'test2_user'@'%' CREATE TABLE
|
||||
test2 t1 'test2_user'@'%' INDEX TABLE
|
||||
test2 t1 'test2_user'@'%' SHOW VIEW TABLE
|
||||
test2 t1 'test2_user'@'%' TRIGGER TABLE
|
||||
test2 t1 'test2_user'@'%' DELETE HISTORY TABLE
|
||||
CREATE ROLE test2_role;
|
||||
GRANT SELECT, UPDATE, DELETE, DROP, INDEX ON t1 to test2_role;
|
||||
# Must show both the user and the role
|
||||
SELECT * FROM sys.table_privileges WHERE table_schema='test2' AND table_name='t1'
|
||||
AND grantee LIKE '%test2%';
|
||||
TABLE_SCHEMA TABLE_NAME GRANTEE PRIVILEGE LEVEL
|
||||
test2 t1 'test2_user'@'%' SELECT TABLE
|
||||
test2 t1 'test2_user'@'%' INSERT TABLE
|
||||
test2 t1 'test2_user'@'%' UPDATE TABLE
|
||||
test2 t1 'test2_user'@'%' CREATE TABLE
|
||||
test2 t1 'test2_user'@'%' INDEX TABLE
|
||||
test2 t1 'test2_user'@'%' SHOW VIEW TABLE
|
||||
test2 t1 'test2_user'@'%' TRIGGER TABLE
|
||||
test2 t1 'test2_user'@'%' DELETE HISTORY TABLE
|
||||
test2 t1 'test2_role'@'' SELECT TABLE
|
||||
test2 t1 'test2_role'@'' UPDATE TABLE
|
||||
test2 t1 'test2_role'@'' DELETE TABLE
|
||||
test2 t1 'test2_role'@'' DROP TABLE
|
||||
test2 t1 'test2_role'@'' INDEX TABLE
|
||||
CREATE VIEW v1 AS SELECT * FROM t1;
|
||||
SELECT * FROM sys.table_privileges WHERE table_schema='test2' AND table_name='v1'
|
||||
AND grantee LIKE '%test2%';
|
||||
TABLE_SCHEMA TABLE_NAME GRANTEE PRIVILEGE LEVEL
|
||||
GRANT SELECT ON v1 TO test2_role;
|
||||
SELECT * FROM sys.table_privileges WHERE table_schema='test2' AND table_name='v1'
|
||||
AND grantee LIKE '%test2%';
|
||||
TABLE_SCHEMA TABLE_NAME GRANTEE PRIVILEGE LEVEL
|
||||
test2 v1 'test2_role'@'' SELECT TABLE
|
||||
GRANT ALL ON v1 TO test2_user;
|
||||
SELECT * FROM sys.table_privileges WHERE table_schema='test2' AND table_name='v1'
|
||||
AND grantee LIKE '%test2%';
|
||||
TABLE_SCHEMA TABLE_NAME GRANTEE PRIVILEGE LEVEL
|
||||
test2 v1 'test2_user'@'%' SELECT TABLE
|
||||
test2 v1 'test2_user'@'%' INSERT TABLE
|
||||
test2 v1 'test2_user'@'%' UPDATE TABLE
|
||||
test2 v1 'test2_user'@'%' DELETE TABLE
|
||||
test2 v1 'test2_user'@'%' CREATE TABLE
|
||||
test2 v1 'test2_user'@'%' DROP TABLE
|
||||
test2 v1 'test2_user'@'%' REFERENCES TABLE
|
||||
test2 v1 'test2_user'@'%' INDEX TABLE
|
||||
test2 v1 'test2_user'@'%' ALTER TABLE
|
||||
test2 v1 'test2_user'@'%' SHOW VIEW TABLE
|
||||
test2 v1 'test2_user'@'%' TRIGGER TABLE
|
||||
test2 v1 'test2_user'@'%' DELETE HISTORY TABLE
|
||||
test2 v1 'test2_role'@'' SELECT TABLE
|
||||
DROP TABLE t1;
|
||||
DROP VIEW v1;
|
||||
DROP USER test2_user;
|
||||
DROP ROLE test2_role;
|
||||
DROP DATABASE test2;
|
@ -0,0 +1,54 @@
|
||||
-- source include/not_embedded.inc
|
||||
# Tests for sys schema
|
||||
# Verify the sys.privileges_by_table_by_level view
|
||||
|
||||
# Ensure structure changes don't slip in
|
||||
DESC sys.privileges_by_table_by_level;
|
||||
|
||||
CREATE DATABASE test1;
|
||||
USE test1;
|
||||
CREATE TABLE t1 (a int);
|
||||
CREATE USER test1_user;
|
||||
|
||||
GRANT ALL PRIVILEGES ON test1.* TO test1_user;
|
||||
|
||||
--echo # Grant all table privileges
|
||||
GRANT ALL ON t1 to test1_user;
|
||||
SELECT table_schema, table_name,
|
||||
CASE WHEN grantee LIKE '\'root%' THEN '<some-root-user>' ELSE GRANTEE END,
|
||||
privilege, level
|
||||
FROM sys.privileges_by_table_by_level WHERE table_name='t1';
|
||||
|
||||
--echo # Revoke some table privileges
|
||||
REVOKE REFERENCES, DELETE, ALTER, DROP ON t1 FROM test1_user;
|
||||
SELECT table_schema, table_name,
|
||||
CASE WHEN grantee LIKE '\'root%' THEN '<some-root-user>' ELSE GRANTEE END,
|
||||
privilege, level
|
||||
FROM sys.privileges_by_table_by_level WHERE table_name='t1';
|
||||
|
||||
CREATE ROLE test1_role;
|
||||
GRANT SELECT, UPDATE, DELETE, DROP, INDEX ON t1 to test1_role;
|
||||
|
||||
--echo # Must show both the user and the role
|
||||
SELECT * FROM sys.privileges_by_table_by_level
|
||||
WHERE table_schema='test1' AND table_name='t1' AND grantee LIKE '%test1%';
|
||||
|
||||
CREATE VIEW v1 AS SELECT * FROM t1;
|
||||
SELECT * FROM sys.privileges_by_table_by_level
|
||||
WHERE table_schema='test1' AND table_name='v1' AND grantee LIKE '%test1%';
|
||||
|
||||
GRANT SELECT ON v1 TO test1_role;
|
||||
SELECT * FROM sys.privileges_by_table_by_level
|
||||
WHERE table_schema='test1' AND table_name='v1' AND grantee LIKE '%test1%';
|
||||
|
||||
GRANT ALL ON v1 TO test1_user;
|
||||
SELECT * FROM sys.privileges_by_table_by_level
|
||||
WHERE table_schema='test1' AND table_name='v1' AND grantee LIKE '%test1%';
|
||||
|
||||
DROP TABLE t1;
|
||||
DROP VIEW v1;
|
||||
DROP USER test1_user;
|
||||
DROP ROLE test1_role;
|
||||
DROP DATABASE test1;
|
||||
|
||||
|
@ -1,53 +0,0 @@
|
||||
-- source include/not_embedded.inc
|
||||
# -- source ../include/ps_truncate_all_tables.inc
|
||||
# Tests for sys schema
|
||||
# Verify the sys.table_privileges view
|
||||
|
||||
# Ensure structure changes don't slip in
|
||||
DESC sys.table_privileges;
|
||||
|
||||
# Make sure view select does not error, but ignore results
|
||||
--disable_result_log
|
||||
SELECT * FROM sys.table_privileges;
|
||||
--enable_result_log
|
||||
|
||||
CREATE DATABASE test2;
|
||||
USE test2;
|
||||
CREATE TABLE t1 (a int);
|
||||
|
||||
CREATE USER test2_user;
|
||||
|
||||
--echo # Grant everything first
|
||||
GRANT ALL ON t1 TO test2_user;
|
||||
SELECT * FROM sys.table_privileges WHERE table_schema='test2' AND table_name='t1'
|
||||
AND grantee LIKE '%test2_user%';
|
||||
|
||||
--echo # Then revoke some privileges
|
||||
REVOKE REFERENCES, DELETE, ALTER, DROP ON t1 FROM test2_user;
|
||||
SELECT * FROM sys.table_privileges WHERE table_schema='test2' AND table_name='t1'
|
||||
AND grantee LIKE '%test2_user%';
|
||||
|
||||
CREATE ROLE test2_role;
|
||||
GRANT SELECT, UPDATE, DELETE, DROP, INDEX ON t1 to test2_role;
|
||||
--echo # Must show both the user and the role
|
||||
SELECT * FROM sys.table_privileges WHERE table_schema='test2' AND table_name='t1'
|
||||
AND grantee LIKE '%test2%';
|
||||
|
||||
CREATE VIEW v1 AS SELECT * FROM t1;
|
||||
SELECT * FROM sys.table_privileges WHERE table_schema='test2' AND table_name='v1'
|
||||
AND grantee LIKE '%test2%';
|
||||
|
||||
GRANT SELECT ON v1 TO test2_role;
|
||||
SELECT * FROM sys.table_privileges WHERE table_schema='test2' AND table_name='v1'
|
||||
AND grantee LIKE '%test2%';
|
||||
GRANT ALL ON v1 TO test2_user;
|
||||
SELECT * FROM sys.table_privileges WHERE table_schema='test2' AND table_name='v1'
|
||||
AND grantee LIKE '%test2%';
|
||||
|
||||
DROP TABLE t1;
|
||||
DROP VIEW v1;
|
||||
DROP USER test2_user;
|
||||
DROP ROLE test2_role;
|
||||
DROP DATABASE test2;
|
||||
|
||||
|
@ -38,7 +38,7 @@ ${CMAKE_CURRENT_SOURCE_DIR}/views/i_s/schema_object_overview.sql
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/views/i_s/schema_auto_increment_columns.sql
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/views/i_s/x_schema_flattened_keys.sql
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/views/i_s/schema_redundant_indexes.sql
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/views/i_s/table_privileges.sql
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/views/i_s/privileges_by_table_by_level.sql
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/ps_check_lost_instrumentation_57.sql
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/latest_file_io.sql
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_latest_file_io.sql
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
### Improvements
|
||||
|
||||
* A new `table_privileges` view was added, which displays privileges on tables granted at all levels (user, schema, table)
|
||||
* A new `privileges_by_table_by_level` view was added, which displays granted privileges broken down by the table on which they allow access and the level on which they were granted
|
||||
|
||||
|
||||
## 1.5.1 (2016-07-07)
|
||||
|
@ -1635,11 +1635,12 @@ mysql> select * from schema_object_overview;
|
||||
10 rows in set (1.58 sec)
|
||||
```
|
||||
|
||||
#### table_privileges
|
||||
#### privileges_by_table_by_level
|
||||
|
||||
##### Description
|
||||
|
||||
-- Shows privileges on existing tables and views granted at all possible levels:
|
||||
-- Shows granted privileges broken down by table on which they allow access
|
||||
-- and level on which they were granted:
|
||||
-- - user_privileges
|
||||
-- - schema_privileges
|
||||
-- - table_privileges
|
||||
@ -1647,7 +1648,7 @@ mysql> select * from schema_object_overview;
|
||||
##### Structure
|
||||
|
||||
```SQL
|
||||
MariaDB [test]> desc sys.table_privileges;
|
||||
MariaDB [test]> desc sys.privileges_by_table_by_level;
|
||||
+--------------+--------------+------+-----+---------+-------+
|
||||
| Field | Type | Null | Key | Default | Extra |
|
||||
+--------------+--------------+------+-----+---------+-------+
|
||||
@ -1663,7 +1664,7 @@ MariaDB [test]> desc sys.table_privileges;
|
||||
##### Example
|
||||
|
||||
```SQL
|
||||
mysql> select * from sys.table_privileges;
|
||||
mysql> select * from sys.privileges_by_table_by_level;
|
||||
+--------------+------------+--------------------+----------------+--------+
|
||||
| TABLE_SCHEMA | TABLE_NAME | GRANTEE | PRIVILEGE_TYPE | LEVEL |
|
||||
+--------------+------------+--------------------+----------------+--------+
|
||||
|
@ -55,7 +55,7 @@ SOURCE ./views/i_s/schema_object_overview.sql
|
||||
SOURCE ./views/i_s/schema_auto_increment_columns.sql
|
||||
SOURCE ./views/i_s/x_schema_flattened_keys.sql
|
||||
SOURCE ./views/i_s/schema_redundant_indexes.sql
|
||||
SOURCE ./views/i_s/table_privileges.sql
|
||||
SOURCE ./views/i_s/privileges_by_table_by_level.sql
|
||||
|
||||
SOURCE ./views/p_s/ps_check_lost_instrumentation.sql
|
||||
SOURCE ./views/p_s/processlist.sql
|
||||
|
@ -56,7 +56,7 @@ SOURCE ./views/i_s/schema_object_overview.sql
|
||||
SOURCE ./views/i_s/schema_auto_increment_columns.sql
|
||||
SOURCE ./views/i_s/x_schema_flattened_keys.sql
|
||||
SOURCE ./views/i_s/schema_redundant_indexes.sql
|
||||
SOURCE ./views/i_s/table_privileges.sql
|
||||
SOURCE ./views/i_s/privileges_by_table_by_level.sql
|
||||
|
||||
SOURCE ./views/p_s/ps_check_lost_instrumentation_57.sql
|
||||
|
||||
|
@ -1,12 +1,13 @@
|
||||
--
|
||||
-- View: table_privileges
|
||||
-- View: privileges_by_table_by_level
|
||||
--
|
||||
-- Shows privileges on existing tables and views granted at all possible levels:
|
||||
-- Shows granted privileges broken down by the table on which they allow access
|
||||
-- and the level on which they were granted:
|
||||
-- - user_privileges
|
||||
-- - schema_privileges
|
||||
-- - table_privileges
|
||||
--
|
||||
-- mysql> select * from sys.table_privileges;
|
||||
-- mysql> select * from sys.privileges_by_table_by_level;
|
||||
-- +--------------+------------+--------------------+----------------+--------+
|
||||
-- | TABLE_SCHEMA | TABLE_NAME | GRANTEE | PRIVILEGE_TYPE | LEVEL |
|
||||
-- +--------------+------------+--------------------+----------------+--------+
|
||||
@ -32,7 +33,7 @@ CREATE OR REPLACE
|
||||
ALGORITHM = TEMPTABLE
|
||||
DEFINER = 'mariadb.sys'@'localhost'
|
||||
SQL SECURITY INVOKER
|
||||
VIEW table_privileges (
|
||||
VIEW privileges_by_table_by_level (
|
||||
TABLE_SCHEMA,
|
||||
TABLE_NAME,
|
||||
GRANTEE,
|
@ -33,5 +33,5 @@ VIEW version (
|
||||
sys_version,
|
||||
mysql_version
|
||||
) AS
|
||||
SELECT '1.5.2' AS sys_version,
|
||||
SELECT '1.5.2' AS sys_version,
|
||||
version() AS mysql_version;
|
||||
|
Loading…
x
Reference in New Issue
Block a user