Debian Codegraph @

mysql-test/suite/perfschema/t/table_schema.test

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