Debian Codegraph @

mysql-test/suite/funcs_1/datadict/columns.inc

raw
1 # suite/funcs_1/datadict/is_columns.inc
2 #
3 # Auxiliary script to be sourced by
4 # is_columns_is
5 # is_columns_mysql
6 # is_columns_<engine>
7 #
8 # Purpose:
9 # Check the content of information_schema.columns about tables within certain
10 # database/s.
11 #
12 # Usage:
13 # The variable $my_where has to
14 # - be set before sourcing this script.
15 # - contain the first part of the WHERE qualification
16 # Example:
17 # let $my_where = WHERE table_schema = 'information_schema'
18 # AND table_name <> 'profiling';
19 # --source suite/funcs_1/datadict/is_columns.inc
20 #
21 # Author:
22 # 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of
23 # testsuite funcs_1
24 # Create this script based on older scripts and new code.
25 #
26 SET sql_mode = 'NO_ENGINE_SUBSTITUTION';
27 --source suite/funcs_1/datadict/datadict_bug_12777.inc
28 --replace_result utf8mb3_tolower_ci utf8_bin
29 eval
30 SELECT * FROM information_schema.columns
31 $my_where
32 ORDER BY table_schema,
33 table_name COLLATE utf8_general_ci,
34 ordinal_position;
35
36 --echo ##########################################################################
37 --echo # Show the quotient of CHARACTER_OCTET_LENGTH and CHARACTER_MAXIMUM_LENGTH
38 --echo ##########################################################################
39 eval
40 SELECT DISTINCT
41 CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
42 DATA_TYPE,
43 CHARACTER_SET_NAME,
44 COLLATION_NAME
45 FROM information_schema.columns
46 $my_where
47 AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH = 1
48 ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML, DATA_TYPE;
49
50 #FIXME 3.2.6.2: check the value 2.0079 tinytext ucs2 ucs2_general_ci
51 eval
52 SELECT DISTINCT
53 CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
54 DATA_TYPE,
55 CHARACTER_SET_NAME,
56 COLLATION_NAME
57 FROM information_schema.columns
58 $my_where
59 AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH <> 1
60 ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML, DATA_TYPE;
61
62 eval
63 SELECT DISTINCT
64 CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
65 DATA_TYPE,
66 CHARACTER_SET_NAME,
67 COLLATION_NAME
68 FROM information_schema.columns
69 $my_where
70 AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH IS NULL
71 ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML, DATA_TYPE;
72
73 echo --> CHAR(0) is allowed (see manual), and here both CHARACHTER_* values;
74 echo --> are 0, which is intended behavior, and the result of 0 / 0 IS NULL;
75 --source suite/funcs_1/datadict/datadict_bug_12777.inc
76 --replace_result utf8mb3_tolower_ci utf8_bin
77 eval
78 SELECT CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
79 TABLE_SCHEMA,
80 TABLE_NAME,
81 COLUMN_NAME,
82 DATA_TYPE,
83 CHARACTER_MAXIMUM_LENGTH,
84 CHARACTER_OCTET_LENGTH,
85 CHARACTER_SET_NAME,
86 COLLATION_NAME,
87 COLUMN_TYPE
88 FROM information_schema.columns
89 $my_where
90 ORDER BY TABLE_SCHEMA, TABLE_NAME COLLATE utf8_general_ci, ORDINAL_POSITION;
91 SET sql_mode = default;