1#### suite/funcs_1/datadict/datadict.pre
2#
3# Auxiliary script which loads prerequisites
4# (variables needed for --replace_result ...)
5# in datadictionary tests.
6#
7# Author:
8# 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of
9#                           testsuite funcs_1
10#                   Create this script based on older scripts and new code.
11#
12--disable_query_log
13
14# Bug#12777 Different size shown for VARCHAR(n) columns (with n> 64)
15#           in INFORMATION_SCHEMA
16# This bug was unfortunately (for testers) declared to be no bug.
17# So CHARACTER_MAXIMUM_LENGTH of several <whatever>_CATALOG columns within
18# the INFORMATION_SCHEMA depends on PATH_MAX of the operating system.
19# Workaround for this problem:
20# Get the size of ONE known colum and check the size against some values to
21# be able to use the correct --replace_result statement. Using this only the
22# one pair of 'wrong' values is replaced and not all occurrencies of all
23# possible pairs of values. See bug #12777 for details.
24SELECT character_maximum_length INTO @CML
25FROM information_schema.columns
26WHERE table_schema = 'information_schema'
27  AND table_name   = 'columns'
28  AND column_name  = 'table_catalog';
29
30let $bug_12777_0512= `SELECT @CML =  512`;
31let $bug_12777_1023= `SELECT @CML = 1023`;
32let $bug_12777_1024= `SELECT @CML = 1024`;
33let $bug_12777_2048= `SELECT @CML = 2048`;
34# 4096 is the value used in the files with expected results.
35let $bug_12777_4095= `SELECT @CML = 4095`;
36if (0)
37{
38   # enable this for debugging only, but NOT in a pushed version, as then the
39   # result changes from OS to OS ...
40   eval SELECT @CML AS 'CML',
41               $bug_12777_0512 AS '512',
42               $bug_12777_1023 AS '1023',
43               $bug_12777_1024 AS '1024',
44               $bug_12777_2048 AS '2048',
45               $bug_12777_4095 AS '4095';
46}
47
48
49# Prepare a variable to be able to suppress machine dependant diffs
50# this can be used in: --replace_result $SERVER_NAME <SERVER_NAME>
51let $SERVER_NAME= `SELECT DISTINCT host FROM mysql.user
52                   WHERE host NOT In ("localhost", "127.0.0.1", "%")`;
53--enable_query_log
54
55