| 1 |
# Test to detect changest to the PERFORMANCE_SCHEMA table schemas |
| 2 |
|
| 3 |
# Use the INFORMATION_SCHEMA to examine the tables in the PERFORMANCE_SCHEMA |
| 4 |
# and detect any tables that have changed. |
| 5 |
|
| 6 |
select * from information_schema.columns where table_schema="performance_schema" |
| 7 |
order by table_name collate utf8_general_ci, ordinal_position; |
| 8 |
|
| 9 |
# Bug#11766504 "59631: BIGINT UNSIGNED BYTE RELATED COLUMNS IN PERFORMANCE_SCHEMA" |
| 10 |
|
| 11 |
# Goal: Confirm that all byte related columns are BIGINT signed. This test will |
| 12 |
# not have to be changed to accommodate new or deleted columns. |
| 13 |
|
| 14 |
# Count the number of NUMBER_OF_BYTES columns. |
| 15 |
|
| 16 |
select count(*) from information_schema.columns |
| 17 |
where table_schema="performance_schema" and data_type = "bigint" |
| 18 |
and column_name like "%number_of_bytes" into @count_byte_columns; |
| 19 |
|
| 20 |
# Confirm that at least one column was found. |
| 21 |
|
| 22 |
select @count_byte_columns > 0; |
| 23 |
|
| 24 |
# Confirm that all NUMBER_OF_BYTES columns are BIGINT signed. |
| 25 |
|
| 26 |
select count(*) from information_schema.columns |
| 27 |
where table_schema="performance_schema" and data_type="bigint" |
| 28 |
and column_name like "%number_of_bytes" |
| 29 |
and column_type not like "%unsigned" into @count_byte_signed; |
| 30 |
|
| 31 |
select (@count_byte_columns - @count_byte_signed) = 0; |
| 32 |
|
| 33 |
# Similar test for OBJECT_INSTANCE_BEGIN values, which are typically derived |
| 34 |
# from a memory address and must therefore be unsigned. |
| 35 |
# |
| 36 |
# Count the number of OBJECT_INSTANCE_BEGIN columns. |
| 37 |
|
| 38 |
select count(*) from information_schema.columns |
| 39 |
where table_schema="performance_schema" and data_type = "bigint" |
| 40 |
and column_name like "%object_instance_begin" into @count_object_columns; |
| 41 |
|
| 42 |
# Confirm that at least one column was found. |
| 43 |
|
| 44 |
select @count_object_columns > 0; |
| 45 |
|
| 46 |
# Confirm that all OBJECT_INSTANCE_BEGIN columns are BIGINT unsigned. |
| 47 |
|
| 48 |
select count(*) from information_schema.columns |
| 49 |
where table_schema="performance_schema" and data_type="bigint" |
| 50 |
and column_name like "%object_instance_begin" |
| 51 |
and column_type like "%unsigned" into @count_object_unsigned; |
| 52 |
|
| 53 |
select (@count_object_columns - @count_object_unsigned) = 0; |
| 54 |
|