1 ###################################################
3 # Functions within VIEWs #
5 ###################################################
6 # 2007-11-09 HHunger enabled all disabled parts belonging to fixed bugs.
7 # 2006-12-08 mleich Maintenance + refinements
8 # 2005-09-14 mleich Create this test
10 # 0. Some notes about this test:
11 # #################################################################
13 # 0.1 This test is unfinished and incomplete, but already useful.
14 # -----------------------------------------------------------------
15 # 0.1.1 There will be architectural changes in future.
16 # The long sequences with
17 # let $col_type= <column to use>;
18 # --source suite/funcs_1/views/<file containing the
19 # select with function>
20 # per every column type do not look very smart.
22 # Ugly combinations of functions and data types must be also checked,
23 # because an accidental typo like assigning a string column to an
24 # numeric parameter could happen and should not result in a server crash.
26 # Maybe it is better to change the architecture of this test in such
28 # 1. A generator script (this one or written in Perl or SP language)
29 # generates an prototype of the the final testscript.
30 # 2. Some manual adjustments because of open bugs (depending on
31 # storage engine or function) might be needed (I hope not :)
32 # 3. The final testscript is pushed to the other regression testscripts.
33 # Advantage: The analysis of bugs, extension and maintenance of this
34 # test will be much easier.
35 # Disadvantage: Much redundant code within the final testscript,
36 # but the maintenance of the redundant code will be done
37 # by the script generator.
39 # 0.1.2 The behaviour of SELECTs on VIEWs could be affected by the SQL mode
40 # which was valid during VIEW creation time. This means some variations
41 # of the SQL mode are needed.
42 # 0.1.3 There are much more functions to be tested.
43 # 0.1.4 The result sets of some CAST sub testcases with ugly function parameter
44 # column data type combinations must be discussed.
47 # 0.2 How to valuate the test results:
48 # ---------------------------------------------------------------------------
49 # Due to the extreme "greedy bug hunting" architecture (combinatorics
50 # + heavy use of sourced scripts) of the following tests, there will be
51 # - no abort of the test execution, when one statements gets an return
52 # code != 0 (The sub testcases are independend.)
53 # But statements, which do not make sense like SELECT on non existent
54 # VIEW will be omitted. This decreases the amount of useless output.
55 # - a file with expected results, which might contain incorrect server
57 # There are open bugs and I cannot omit statements which reveal these
59 # But there will be a special messages within the protocol files.
61 # "Attention: CAST --> SIGNED INTEGER
62 # The file with expected results suffers from Bug 5913";
63 # means, the file with expected results contains result sets which
64 # are known to be wrong.
65 # "Attention: The last <whatever> failed"
66 # means, a statement which should be successful (bugfree MySQL)
69 # "Passed" : The behaviour of your MySQL version does not differ from the
70 # version used to generate the files with expected results.
71 # Known bugs affecting these tests could be retrieved by
72 # grep "Attention" r/<testcase>.result .
74 # "Failed" : The behaviour of your MySQL version differs from the version
75 # used to generate the files with expected results.
76 # These differences could be result of bug fixes or new bugs.
77 # Please compare r/<testcase>.reject and r/<testcase>.result .
79 # The test will abort if one of the basic preparation statement fails
80 # (except ALTER TABLE ADD ...).
83 # 0.3 How to debug sub testcases with "unexpected" results:
84 # ---------------------------------------------------------------------------
85 # 1. Please execute this test and copy the "reject" file to a save place.
86 # Search within the "reject" file for the sub testcase (the SELECT)
87 # with the suspicious result set or server response.
88 # Now all t1_values records are preloaded.
89 # 2. Start the server without the initial cleanup of databases etc.
90 # This preserves the content of the table t1_values, which
91 # might be needed for replaying the situation.
93 # ./mysql-test-run.pl --socket=var/tmp/master.sock --start-dirty
94 # 3. Issue the statements needed by using "mysql" or "mysqltest".
96 # Maybe an internal routine of this test fails. Please ask me (mleich) or
97 # enable the logging of auxiliary queries and try to analyze the
101 # 0.4 How to extend the number of functions to be checked:
102 # ---------------------------------------------------------------------------
103 # Please jump to the paragraphs of the basic preparations
104 # 1. Extend t1_values with the columns you need
105 # 2. Insert some predefinded rows
106 # 3. Add the SELECTs with function which should be used within VIEWs
108 # records which should be used dedicated to the SELECT above
111 # 0.5 How to alter the internal routines of this test:
112 # ---------------------------------------------------------------------------
113 # Please try to achieve a state where the protocol
114 # - contains ALL statements, which are needed to replay a problem within
115 # the field of functions within VIEWs
116 # - does not contain too much auxiliary statements, which are not needed
117 # to replay a problem (--> "--disable_query_log")
120 # - DROP/CREATE TABLE t1_values
121 # - INSERT of records into t1_values
122 # - DROP/CREATE/SELECT/SHOW VIEW v1
123 # - SELECT direct on base table
124 # Not needed for replay:
125 # - SET @<uservariable> = <value>
126 # - DROP/CREATE/INSERT/SELECT TABLE t1_selects, t1_modes
129 # 0.6 A trick for checking results
130 # ---------------------------------------------------------------------------
131 # Standard setting for common execution of this test:
132 let $simple_select_result= 1;
133 let $view_select_result= 1;
134 # The implementation of some additional function tests may lead to
135 # masses of result sets, which have to be checked. The result sets of
136 # the simple selects on the base table must equal the result sets of the
137 # queries on the VIEWs. This step could be made more comfortable by
138 # 1. Edit this file to
139 # let $simple_select_result= 1;
140 # let $view_select_result= 0;
141 # Please execute this test.
142 # The script will omit CREATE/DROP/SHOW/SELECT on VIEW.
143 # The "reject" file contains only the simple select result sets.
144 # 2. Edit this file to
145 # let $simple_select_result= 0;
146 # let $view_select_result= 1;
147 # Please execute this test.
148 # The script will work with the VIEWs, but omit the simple selects.
149 # The "reject" file contains the view select result sets.
150 # 3. Compare the "reject" files of 1. and 2. within a graphical diff tool.
154 # For TIME to DATETIME/TIMESTAMP conversion:
155 SET timestamp=UNIX_TIMESTAMP(
'2010-01-01');
158 DROP
TABLE IF EXISTS t1_selects, t1_modes, t1_values;
159 DROP VIEW IF EXISTS v1;
163 # Storage for the SELECTs to be used for the VIEW definition
164 # Attention: my_select must be no too small because a statement like
165 # SELECT LOAD_FILE(< file in MYSQLTEST_VARDIR >)
167 # id FROM t1_values';
168 # might be a very long
169 # Bug#38427 "Data too long" ... tests "<ENGINE>_func_view" fail
170 CREATE
TABLE t1_selects
172 id BIGINT AUTO_INCREMENT,
173 my_select VARCHAR(1000) NOT NULL,
174 disable_result ENUM(
'Yes',
'No') NOT NULL
default 'No',
179 # MODES to be checked
180 CREATE
TABLE t1_modes
182 id BIGINT AUTO_INCREMENT,
183 my_mode VARCHAR(200) NOT NULL,
189 # The table to be used in the FROM parts of the SELECTs
190 --replace_result $type <engine_to_be_tested>
191 eval CREATE
TABLE t1_values
193 id BIGINT AUTO_INCREMENT,
198 ##### BEGIN Basic preparations #######################################
200 # 1. Extend t1_values with the columns you need
201 # - the column name must show the data type
202 # - do not add NOT NULL columns
203 # - do not worry if the intended column data type is not
204 # available for some storage engines
205 # Please do not forget to assign values for the new columns (paragraph 2.).
206 --disable_abort_on_error
207 ALTER
TABLE t1_values ADD my_char_30 CHAR(30);
208 ALTER
TABLE t1_values ADD my_varchar_1000 VARCHAR(1000);
209 ALTER
TABLE t1_values ADD my_binary_30 BINARY(30);
210 ALTER
TABLE t1_values ADD my_varbinary_1000 VARBINARY(1000);
211 ALTER
TABLE t1_values ADD my_datetime DATETIME;
212 ALTER
TABLE t1_values ADD my_date DATE;
213 ALTER
TABLE t1_values ADD ts_dummy TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
214 ALTER
TABLE t1_values ADD my_timestamp TIMESTAMP NOT NULL DEFAULT
'0000-00-00 00:00:00';
215 ALTER
TABLE t1_values ADD my_time TIME;
216 ALTER
TABLE t1_values ADD my_year YEAR;
217 ALTER
TABLE t1_values ADD my_bigint BIGINT;
218 ALTER
TABLE t1_values ADD my_double DOUBLE;
220 --enable_abort_on_error
222 #-------------------------------------------------------------------------------
225 # 2. Insert some predefinded rows
227 # - t1_values.select_id IS NULL
228 # - will be selected by every SELECT with function to be tested
229 # - have to be inserted when sql_mode = 'traditional' is valid, because
230 # we do not want to start with "illegal/unexpected/..." values.
231 # Such experiments should be done in other testcases.
233 # - modifying column values of predefined rows they might change many
235 # - additional predefined rows should be really useful for the majority of
236 # all sub testcases, since they blow up all result sets.
237 SET sql_mode =
'traditional';
239 # 2.1 record -- everything to NULL
240 INSERT INTO t1_values SET
id = 0;
242 # 2.2 record -- everything to "minimum"
243 # numbers, date/time types -> minimum of range
244 # strings, blobs, binaries -> ''
246 INSERT INTO t1_values SET
248 my_varchar_1000 =
'',
250 my_varbinary_1000 =
'',
251 my_datetime =
'0001-01-01 00:00:00',
252 my_date =
'0001-01-01',
253 my_timestamp =
'1970-01-01 03:00:01',
254 my_time =
'-838:59:59',
256 my_bigint = -9223372036854775808,
257 my_decimal = -9999999999999999999999999999999999.999999999999999999999999999999 ,
258 my_double = -1.7976931348623E+308;
259 # shortened due to bug#32285
260 # my_double = -1.7976931348623157E+308;
262 # 2.3 record -- everything to "maximum"
263 # numbers, date/time types -> maximum of range
264 # strings, blobs, binaries -> '<- full length of used data type>'
266 INSERT INTO t1_values SET
267 my_char_30 =
'<--------30 characters------->',
268 my_varchar_1000 = CONCAT(
'<---------1000 characters',
269 RPAD(
'',965,
'-'),
'--------->'),
270 my_binary_30 =
'<--------30 characters------->',
271 my_varbinary_1000 = CONCAT(
'<---------1000 characters',
272 RPAD(
'',965,
'-'),
'--------->'),
273 my_datetime =
'9999-12-31 23:59:59',
274 my_date =
'9999-12-31',
275 my_timestamp =
'2038-01-01 02:59:59',
276 my_time =
'838:59:59',
278 my_bigint = 9223372036854775807,
279 my_decimal = +9999999999999999999999999999999999.999999999999999999999999999999 ,
280 my_double = 1.7976931348623E+308;
281 # shortened due to bug#32285
282 # my_double = -1.7976931348623157E+308;
284 # 2.4 record -- everything to "magic" value if available or
285 # other interesting value
287 # strings, blobs, binaries -> not full length of used data type, "exotic"
288 # characters and preceeding and trailing spaces
290 INSERT INTO t1_values SET
291 my_char_30 =
' ---äÖüß@µ*$-- ',
292 my_varchar_1000 =
' ---äÖüß@µ*$-- ',
293 my_binary_30 =
' ---äÖüß@µ*$-- ',
294 my_varbinary_1000 =
' ---äÖüß@µ*$-- ',
295 my_datetime =
'2004-02-29 23:59:59',
296 my_date =
'2004-02-29',
297 my_timestamp =
'2004-02-29 23:59:59',
298 my_time =
'13:00:00',
304 # 2.5 record -- everything to "harmless" value if available
305 # numbers -> -1 (logical)
306 # strings, blobs, binaries -> '-1' useful for numeric functions
308 INSERT INTO t1_values SET
310 my_varchar_1000 =
'-1',
312 my_varbinary_1000 =
'-1',
313 my_datetime =
'2005-06-28 10:00:00',
314 my_date =
'2005-06-28',
315 my_timestamp =
'2005-06-28 10:00:00',
316 my_time =
'10:00:00',
319 my_decimal = -1.000000000000000000000000000000,
322 #-------------------------------------------------------------------------------
325 # 3. Add the SELECTs with function which should be used within VIEWs
327 # records which should be used dedicated to the SELECT above
328 # - Please avoid WHERE clauses
329 # - Include the PRIMARY KEY ("id") of the base table t1_values into the
331 # - Include the base table column used as function parameter into the
332 # select column list, because it is much easier to check the results
333 # - Do not forget to escape single quotes
335 # SET @my_select = 'SELECT sqrt(my_bigint), my_bigint, id FROM t1_values'
336 # SET @my_select = 'SELECT CONCAT(\'A\',my_char_30), id FROM t1_values';
337 # - Statements, which reveal open crashing bugs MUST be disabled.
338 # - Result sets must not contain data, which might differ between boxes
339 # executing this test.
340 # Example: current time, absolute path to some files ...
341 # - Please derive the functions to be checked from the MySQL manual
342 # and use the same order. This means copy the the function names as
343 # comment into this test and start to implement a testcase for your
344 # most preferred function.
345 # This method avoids that we forget a function and gives a better
348 # If you have the time to check the result sets do the insert of the
349 # SELECT with function via:
350 # eval SET @my_select =
352 # --source suite/funcs_1/views/fv1.inc
353 # fv1.inc sets t1_selects.disable_result to 'No' and the effect will be,
354 # that the result set will be logged.
356 # If you do not have the time to check the result sets do the insert of the
357 # SELECT with function via:
358 # eval SET @my_select =
360 # --source suite/funcs_1/views/fv2.inc
361 # fv2.inc sets t1_selects.disable_result to 'Yes' and the effect will be,
362 # that the result set will be not logged.
363 # This should be only a temporary solution and it does not remove the
364 # need to check the server return codes.
365 # That means even when we do not have the time to check the correctness of
366 # the result sets, we check if
367 # - SELECT <function> or
368 # - SELECT * FROM <VIEW with function>
369 # crash the server or get suspicious server responses.
371 # - the SELECTs will be applied to the rows defined here (3.) +
372 # all predefined rows (2.)
373 # - the rows dedicated to the SELECT should contain especially interesting
374 # column values or combinations of column values, which are not covered
375 # by the predefined records
376 # - The records have to be inserted when sql_mode = 'traditional' is valid.
377 # - Please do not insert records with column values where the allowed
378 # range is exceeded. The SQL mode 'traditional' will prevent such
379 # inserts. Such experiments should be done in other tests, because
380 # they inflate the current test without giving an appropriate value.
383 # The function to be tested is "sqrt".
384 # The minimum, maximum, default and NULL value are covered by the
386 # A value where sqrt(<value>) = <integer value> in strict mathematics
387 # would be of interest.
388 # --> Add a record with my_bigint = 4
389 # --> Just for fun my_bigint = -25 .
391 # Some internal stuff
392 PREPARE ins_sel_with_result FROM
"INSERT INTO t1_selects SET my_select = @my_select,
393 disable_result = 'No'" ;
394 PREPARE ins_sel_no_result FROM
"INSERT INTO t1_selects SET my_select = @my_select,
395 disable_result = 'Yes'" ;
396 SET sql_mode =
'traditional';
397 # --disable_query_log
399 let $col_type= my_bigint;
401 # eval SET @my_select = 'SELECT CONCAT(''A'', $col_type), $col_type, id';
402 eval SET @my_select =
'SELECT sqrt($col_type), $col_type, id FROM t1_values';
403 --source suite/funcs_1/views/fv1.inc
404 # Content of suite/funcs_1/views/fv1.inc :
405 # --disable_query_log
406 # EXECUTE ins_sel_with_result;
407 # SET @select_id = LAST_INSERT_ID();
410 eval INSERT INTO t1_values SET select_id = @select_id,
412 eval INSERT INTO t1_values SET select_id = @select_id,
414 # SELECT * FROM t1_values;
416 # 1. Cast Functions and Operators
419 # Note(mleich): I guess the CAST routines are used in many other functions.
420 # Therefore check also nearly all "ugly" variants like
421 # CAST(<string composed of non digits> AS DECIMAL) here.
423 # suite/funcs_1/views/fv_cast.inc contains
424 # SELECT CAST($col_type AS $target_type), ...
427 # 1.1.1. CAST --> BINARY
428 --echo ##### 1.1.1. CAST --> BINARY
429 let $target_type= BINARY;
431 let $col_type= my_char_30;
432 --source suite/funcs_1/views/fv_cast.inc
433 let $col_type= my_varchar_1000;
434 --source suite/funcs_1/views/fv_cast.inc
435 let $col_type= my_binary_30;
436 --source suite/funcs_1/views/fv_cast.inc
437 let $col_type= my_varbinary_1000;
438 --source suite/funcs_1/views/fv_cast.inc
439 let $col_type= my_bigint;
440 --source suite/funcs_1/views/fv_cast.inc
442 --source suite/funcs_1/views/fv_cast.inc
443 let $col_type= my_double;
444 --source suite/funcs_1/views/fv_cast.inc
445 let $col_type= my_datetime;
446 --source suite/funcs_1/views/fv_cast.inc
447 let $col_type= my_date;
448 --source suite/funcs_1/views/fv_cast.inc
449 let $col_type= my_timestamp;
450 --source suite/funcs_1/views/fv_cast.inc
451 let $col_type= my_time;
452 --source suite/funcs_1/views/fv_cast.inc
453 let $col_type= my_year;
454 --source suite/funcs_1/views/fv_cast.inc
457 # 1.1.2. CAST --> CHAR
458 --echo ##### 1.1.2. CAST --> CHAR
459 let $target_type= CHAR;
461 let $col_type= my_char_30;
462 --source suite/funcs_1/views/fv_cast.inc
463 let $col_type= my_varchar_1000;
464 --source suite/funcs_1/views/fv_cast.inc
465 let $col_type= my_binary_30;
466 --source suite/funcs_1/views/fv_cast.inc
467 let $col_type= my_varbinary_1000;
468 --source suite/funcs_1/views/fv_cast.inc
469 let $col_type= my_bigint;
470 --source suite/funcs_1/views/fv_cast.inc
472 --source suite/funcs_1/views/fv_cast.inc
473 let $col_type= my_double;
474 --source suite/funcs_1/views/fv_cast.inc
475 let $col_type= my_datetime;
476 --source suite/funcs_1/views/fv_cast.inc
477 let $col_type= my_date;
478 --source suite/funcs_1/views/fv_cast.inc
479 let $col_type= my_timestamp;
480 --source suite/funcs_1/views/fv_cast.inc
481 let $col_type= my_time;
482 --source suite/funcs_1/views/fv_cast.inc
483 let $col_type= my_year;
484 --source suite/funcs_1/views/fv_cast.inc
487 # 1.1.3. CAST --> DATE
488 --echo ##### 1.1.3. CAST --> DATE
489 let $target_type= DATE;
491 let $col_type= my_char_30;
492 --source suite/funcs_1/views/fv_cast.inc
493 eval INSERT INTO t1_values SET select_id = @select_id,
494 $col_type =
'2005-06-27';
495 let $col_type= my_varchar_1000;
496 --source suite/funcs_1/views/fv_cast.inc
497 eval INSERT INTO t1_values SET select_id = @select_id,
498 $col_type =
'2005-06-27';
499 let $col_type= my_binary_30;
500 --source suite/funcs_1/views/fv_cast.inc
501 eval INSERT INTO t1_values SET select_id = @select_id,
502 $col_type =
'2005-06-27';
503 let $col_type= my_varbinary_1000;
504 --source suite/funcs_1/views/fv_cast.inc
505 eval INSERT INTO t1_values SET select_id = @select_id,
506 $col_type =
'2005-06-27';
507 let $col_type= my_bigint;
508 --source suite/funcs_1/views/fv_cast.inc
509 eval INSERT INTO t1_values SET select_id = @select_id,
510 $col_type = 20050627;
511 let $col_type= my_double;
512 --source suite/funcs_1/views/fv_cast.inc
513 eval INSERT INTO t1_values SET select_id = @select_id,
514 $col_type = +20.050627E+6;
515 let $col_type= my_datetime;
516 --source suite/funcs_1/views/fv_cast.inc
517 let $col_type= my_date;
518 --source suite/funcs_1/views/fv_cast.inc
519 let $col_type= my_timestamp;
520 --source suite/funcs_1/views/fv_cast.inc
521 let $col_type= my_time;
522 --source suite/funcs_1/views/fv_cast.inc
523 let $col_type= my_year;
524 --source suite/funcs_1/views/fv_cast.inc
527 # 1.1.4. CAST --> DATETIME
528 --echo ##### 1.1.4. CAST --> DATETIME
529 let $target_type= DATETIME;
531 let $col_type= my_char_30;
532 --source suite/funcs_1/views/fv_cast.inc
533 eval INSERT INTO t1_values SET select_id = @select_id,
534 $col_type =
'2005-06-27 17:58';
535 let $col_type= my_varchar_1000;
536 --source suite/funcs_1/views/fv_cast.inc
537 eval INSERT INTO t1_values SET select_id = @select_id,
538 $col_type =
'2005-06-27 17:58';
539 let $col_type= my_binary_30;
540 --source suite/funcs_1/views/fv_cast.inc
541 eval INSERT INTO t1_values SET select_id = @select_id,
542 $col_type =
'2005-06-27 17:58';
543 let $col_type= my_varbinary_1000;
544 --source suite/funcs_1/views/fv_cast.inc
545 eval INSERT INTO t1_values SET select_id = @select_id,
546 $col_type =
'2005-06-27 17:58';
547 let $col_type= my_bigint;
548 --source suite/funcs_1/views/fv_cast.inc
549 eval INSERT INTO t1_values SET select_id = @select_id,
550 $col_type = 200506271758;
551 let $col_type= my_double;
552 --source suite/funcs_1/views/fv_cast.inc
553 eval INSERT INTO t1_values SET select_id = @select_id,
554 $col_type = +0.0200506271758E+13;
555 let $col_type= my_datetime;
556 --source suite/funcs_1/views/fv_cast.inc
557 let $col_type= my_date;
558 --source suite/funcs_1/views/fv_cast.inc
559 let $col_type= my_timestamp;
560 --source suite/funcs_1/views/fv_cast.inc
561 let $col_type= my_time;
562 --source suite/funcs_1/views/fv_cast.inc
563 let $col_type= my_year;
564 --source suite/funcs_1/views/fv_cast.inc
567 # 1.1.5. CAST --> TIME
568 --echo ##### 1.1.5. CAST --> TIME
569 let $target_type= TIME;
571 let $col_type= my_char_30;
572 --source suite/funcs_1/views/fv_cast.inc
573 eval INSERT INTO t1_values SET select_id = @select_id,
574 $col_type =
'1 17:58';
575 let $col_type= my_varchar_1000;
576 --source suite/funcs_1/views/fv_cast.inc
577 eval INSERT INTO t1_values SET select_id = @select_id,
578 $col_type =
'1 17:58';
579 let $col_type= my_binary_30;
580 --source suite/funcs_1/views/fv_cast.inc
581 eval INSERT INTO t1_values SET select_id = @select_id,
582 $col_type =
'1 17:58';
583 let $col_type= my_varbinary_1000;
584 --source suite/funcs_1/views/fv_cast.inc
585 eval INSERT INTO t1_values SET select_id = @select_id,
586 $col_type =
'1 17:58';
587 let $col_type= my_bigint;
588 --source suite/funcs_1/views/fv_cast.inc
589 eval INSERT INTO t1_values SET select_id = @select_id,
591 let $col_type= my_double;
592 # Bug#12440: CAST(data type DOUBLE AS TIME) strange results;
593 --source suite/funcs_1/views/fv_cast.inc
594 eval INSERT INTO t1_values SET select_id = @select_id,
595 $col_type = +1.758E+3;
596 let $col_type= my_datetime;
597 --source suite/funcs_1/views/fv_cast.inc
598 let $col_type= my_date;
599 --source suite/funcs_1/views/fv_cast.inc
600 let $col_type= my_timestamp;
601 --source suite/funcs_1/views/fv_cast.inc
602 let $col_type= my_time;
603 --source suite/funcs_1/views/fv_cast.inc
604 let $col_type= my_year;
605 --source suite/funcs_1/views/fv_cast.inc
608 # 1.1.6. CAST --> DECIMAL
609 --echo ##### 1.1.6. CAST --> DECIMAL
610 # Set the following to (37,2) since the default was changed to (10,0) - OBN
611 let $target_type= DECIMAL(37,2);
613 let $col_type= my_char_30;
614 --source suite/funcs_1/views/fv_cast.inc
615 eval INSERT INTO t1_values SET select_id = @select_id,
616 $col_type =
'-3333.3333';
617 let $col_type= my_varchar_1000;
618 --source suite/funcs_1/views/fv_cast.inc
619 eval INSERT INTO t1_values SET select_id = @select_id,
620 $col_type =
'-3333.3333';
621 let $col_type= my_binary_30;
622 --source suite/funcs_1/views/fv_cast.inc
623 eval INSERT INTO t1_values SET select_id = @select_id,
624 $col_type =
'-3333.3333';
625 let $col_type= my_varbinary_1000;
626 --source suite/funcs_1/views/fv_cast.inc
627 eval INSERT INTO t1_values SET select_id = @select_id,
628 $col_type =
'-3333.3333';
629 let $col_type= my_bigint;
630 --source suite/funcs_1/views/fv_cast.inc
632 --source suite/funcs_1/views/fv_cast.inc
633 # Bug#13349: CAST(1.0E+300 TO DECIMAL) returns wrong result + diff little/big endian;
634 let $col_type= my_double;
635 --source suite/funcs_1/views/fv_cast.inc
636 eval INSERT INTO t1_values SET select_id = @select_id,
637 $col_type = -0.33333333E+4;
638 let $col_type= my_datetime;
639 --source suite/funcs_1/views/fv_cast.inc
640 let $col_type= my_date;
641 --source suite/funcs_1/views/fv_cast.inc
642 let $col_type= my_timestamp;
643 --source suite/funcs_1/views/fv_cast.inc
644 let $col_type= my_time;
645 --source suite/funcs_1/views/fv_cast.inc
646 let $col_type= my_year;
647 --source suite/funcs_1/views/fv_cast.inc
650 # 1.1.7. CAST --> SIGNED INTEGER
651 --echo ##### 1.1.7. CAST --> SIGNED INTEGER
652 let $target_type= SIGNED INTEGER;
655 "Attention: CAST --> SIGNED INTEGER
656 Bug#5913 Traditional mode: BIGINT range not correctly delimited
657 Status: To be fixed later";
658 --source include/show_msg80.inc
659 let $col_type= my_char_30;
660 --source suite/funcs_1/views/fv_cast.inc
661 let $col_type= my_varchar_1000;
662 --source suite/funcs_1/views/fv_cast.inc
663 let $col_type= my_binary_30;
664 --source suite/funcs_1/views/fv_cast.inc
665 let $col_type= my_varbinary_1000;
666 --source suite/funcs_1/views/fv_cast.inc
667 let $col_type= my_bigint;
668 --source suite/funcs_1/views/fv_cast.inc
670 --source suite/funcs_1/views/fv_cast.inc
671 # Bug #13344: CAST(1E+300 TO signed int) on little endian CPU, wrong result;
672 let $col_type= my_double;
673 --source suite/funcs_1/views/fv_cast.inc
674 let $col_type= my_datetime;
675 --source suite/funcs_1/views/fv_cast.inc
676 let $col_type= my_date;
677 --source suite/funcs_1/views/fv_cast.inc
678 let $col_type= my_timestamp;
679 --source suite/funcs_1/views/fv_cast.inc
680 let $col_type= my_time;
681 --source suite/funcs_1/views/fv_cast.inc
682 let $col_type= my_year;
683 --source suite/funcs_1/views/fv_cast.inc
686 # 1.1.8. CAST --> UNSIGNED INTEGER
687 --echo ##### 1.1.8. CAST --> UNSIGNED INTEGER
688 let $target_type= UNSIGNED INTEGER;
691 "Attention: CAST --> UNSIGNED INTEGER
692 The file with expected results suffers from Bug 5913";
693 --source include/show_msg80.inc
694 let $col_type= my_char_30;
695 --source suite/funcs_1/views/fv_cast.inc
696 let $col_type= my_varchar_1000;
697 --source suite/funcs_1/views/fv_cast.inc
698 let $col_type= my_binary_30;
699 --source suite/funcs_1/views/fv_cast.inc
700 let $col_type= my_varbinary_1000;
701 --source suite/funcs_1/views/fv_cast.inc
702 let $col_type= my_bigint;
703 --source suite/funcs_1/views/fv_cast.inc
705 --source suite/funcs_1/views/fv_cast.inc
706 let $message= some statements disabled because of
707 Bug#5913 Traditional
mode: BIGINT range not correctly delimited;
708 --source include/show_msg80.inc
709 # Bug#8663 cant use bgint unsigned as input to cast
710 let $col_type= my_double;
711 --source suite/funcs_1/views/fv_cast.inc
712 let $col_type= my_datetime;
713 --source suite/funcs_1/views/fv_cast.inc
714 let $col_type= my_date;
715 --source suite/funcs_1/views/fv_cast.inc
716 let $col_type= my_timestamp;
717 --source suite/funcs_1/views/fv_cast.inc
718 let $col_type= my_time;
719 --source suite/funcs_1/views/fv_cast.inc
720 let $col_type= my_year;
721 --source suite/funcs_1/views/fv_cast.inc
725 # Manual: BINARY str is a shorthand for CAST(str AS BINARY).
726 # Therefore we do not test it here in the moment.
727 # FIXME: Add testcases for str in CHAR and VARCHAR only.
730 # 1.3 CONVERT(expr USING transcoding_name)
732 # 1.3.1 CONVERT(expr USING utf8)
733 let $target_charset= utf8;
735 let $col_type= my_char_30;
736 eval SET @my_select =
'SELECT CONVERT($col_type USING $target_charset),
737 $col_type, id FROM t1_values';
738 --source suite/funcs_1/views/fv1.inc
739 let $col_type= my_varchar_1000;
740 eval SET @my_select =
'SELECT CONVERT($col_type USING $target_charset),
741 $col_type, id FROM t1_values';
742 --source suite/funcs_1/views/fv1.inc
743 let $col_type= my_binary_30;
744 eval SET @my_select =
'SELECT CONVERT($col_type USING $target_charset),
745 $col_type, id FROM t1_values';
746 --source suite/funcs_1/views/fv1.inc
747 let $col_type= my_varbinary_1000;
748 eval SET @my_select =
'SELECT CONVERT($col_type USING $target_charset),
749 $col_type, id FROM t1_values';
750 --source suite/funcs_1/views/fv1.inc
752 # 1.3.2 CONVERT(expr USING koi8r)
753 let $target_charset= koi8r;
754 let $col_type= my_char_30;
755 eval SET @my_select =
'SELECT CONVERT($col_type USING $target_charset),
756 $col_type, id FROM t1_values';
757 --source suite/funcs_1/views/fv1.inc
758 let $col_type= my_varchar_1000;
759 eval SET @my_select =
'SELECT CONVERT($col_type USING $target_charset),
760 $col_type, id FROM t1_values';
761 --source suite/funcs_1/views/fv1.inc
762 let $col_type= my_binary_30;
763 eval SET @my_select =
'SELECT CONVERT($col_type USING $target_charset),
764 $col_type, id FROM t1_values';
765 --source suite/funcs_1/views/fv1.inc
766 let $col_type= my_varbinary_1000;
767 eval SET @my_select =
'SELECT CONVERT($col_type USING $target_charset),
768 $col_type, id FROM t1_values';
769 --source suite/funcs_1/views/fv1.inc
772 # 2. Control Flow Functions
773 # 2.1. CASE value WHEN [compare-value] THEN result [WHEN ...] [ELSE result]
775 # CASE WHEN [condition] THEN result [WHEN ...] [ELSE result] END
777 # FIXME: to be implemented
779 # 2.2. IF(expr1,expr2,expr3)
780 # expr1 is TRUE when (expr1 <> 0 and expr1 <> NULL) is fulfilled
782 # 2.2.1 IF(expr1,expr2,expr3) with expr1 = <column>
784 # Note(mleich): Strings, which do not contain a number -> FALSE
786 # suite/funcs_1/views/fv_if1.inc contains
787 # SELECT IF($col_type, 'IS TRUE', 'IS NOT TRUE'), ...
789 let $col_type= my_char_30;
790 --source suite/funcs_1/views/fv_if1.inc
792 let $col_type= my_varchar_1000;
793 --source suite/funcs_1/views/fv_if1.inc
795 let $col_type= my_binary_30;
796 --source suite/funcs_1/views/fv_if1.inc
798 let $col_type= my_varbinary_1000;
799 --source suite/funcs_1/views/fv_if1.inc
801 let $col_type= my_bigint;
802 --source suite/funcs_1/views/fv_if1.inc
805 --source suite/funcs_1/views/fv_if1.inc
807 let $col_type= my_double;
808 --source suite/funcs_1/views/fv_if1.inc
810 let $col_type= my_datetime;
811 --source suite/funcs_1/views/fv_if1.inc
813 let $col_type= my_date;
814 --source suite/funcs_1/views/fv_if1.inc
816 let $col_type= my_timestamp;
817 --source suite/funcs_1/views/fv_if1.inc
819 let $col_type= my_time;
820 --source suite/funcs_1/views/fv_if1.inc
822 let $col_type= my_year;
823 --source suite/funcs_1/views/fv_if1.inc
826 # 2.2.2 IF(expr1,expr2,expr3) with expr1 != <column>
828 # suite/funcs_1/views/fv_if2.inc contains
829 # SELECT IF($col_type IS NULL, 'IS NULL', 'IS NOT NULL'), ...
831 # Note(mleich): July 2005
832 # IF($col_type IS NULL, ...) is mapped to a VIEW definition
833 # create ... view ... as
834 # select if(isnull(`test`.`t1`.`f1`),_latin1'IS NULL',
835 # _latin1'IS NOT NULL'),...
837 # Bug#11689 success on Create view .. IF(col1 IS NULL,...), col2 ; but SELECT fails
838 let $col_type= my_char_30;
839 --source suite/funcs_1/views/fv_if2.inc
841 let $col_type= my_varchar_1000;
842 --source suite/funcs_1/views/fv_if2.inc
844 let $col_type= my_binary_30;
845 --source suite/funcs_1/views/fv_if2.inc
847 let $col_type= my_varbinary_1000;
848 --source suite/funcs_1/views/fv_if2.inc
850 let $col_type= my_bigint;
851 --source suite/funcs_1/views/fv_if2.inc
854 --source suite/funcs_1/views/fv_if2.inc
856 let $col_type= my_double;
857 --source suite/funcs_1/views/fv_if2.inc
859 let $col_type= my_datetime;
860 --source suite/funcs_1/views/fv_if2.inc
862 let $col_type= my_date;
863 --source suite/funcs_1/views/fv_if2.inc
865 let $col_type= my_timestamp;
866 --source suite/funcs_1/views/fv_if2.inc
868 let $col_type= my_time;
869 --source suite/funcs_1/views/fv_if2.inc
871 let $col_type= my_year;
872 --source suite/funcs_1/views/fv_if2.inc
875 # 2.3. IFNULL(expr1,expr2)
876 # If expr1 is not NULL, IFNULL() returns expr1, else it returns expr2.
878 # suite/funcs_1/views/fv_ifnull.inc contains
879 # SELECT IFNULL($col_type, 'IS_NULL'), ....
880 # FIXME: The mixup of non string column values
881 # and the string 'IS NULL' within the first column of the
882 # result table is extreme ugly.
883 # CAST(IFNULL($col_type, 'IS_NULL') AS CHAR) looks better, but
884 # it has the disadvantage, that it involves CAST as additional
887 let $col_type= my_char_30;
888 --source suite/funcs_1/views/fv_ifnull.inc
890 let $col_type= my_varchar_1000;
891 --source suite/funcs_1/views/fv_ifnull.inc
893 let $col_type= my_binary_30;
894 --source suite/funcs_1/views/fv_ifnull.inc
896 let $col_type= my_varbinary_1000;
897 --source suite/funcs_1/views/fv_ifnull.inc
899 let $col_type= my_bigint;
900 --source suite/funcs_1/views/fv_ifnull.inc
903 --source suite/funcs_1/views/fv_ifnull.inc
905 let $col_type= my_double;
906 --source suite/funcs_1/views/fv_ifnull.inc
908 let $col_type= my_datetime;
909 --source suite/funcs_1/views/fv_ifnull.inc
911 let $col_type= my_date;
912 --source suite/funcs_1/views/fv_ifnull.inc
914 let $col_type= my_timestamp;
915 --source suite/funcs_1/views/fv_ifnull.inc
917 let $col_type= my_time;
918 --source suite/funcs_1/views/fv_ifnull.inc
920 let $col_type= my_year;
921 --source suite/funcs_1/views/fv_ifnull.inc
924 # 2.4. NULLIF(expr1,expr2)
925 # Returns NULL if expr1 = expr2 is true, else returns expr1.
926 # This is the same as
927 # CASE WHEN expr1 = expr2 THEN NULL ELSE expr1 END.
929 # FIXME: to be implemented
933 # 3. String Functions
936 # FIXME: to be implemented
938 # 3.3. BIT_LENGTH(str)
939 # Returns the length of the string str in bits.
941 let $col_type= my_char_30;
942 eval SET @my_select =
'SELECT BIT_LENGTH($col_type),
943 $col_type, id FROM t1_values';
944 --source suite/funcs_1/views/fv1.inc
945 let $col_type= my_varchar_1000;
946 eval SET @my_select =
'SELECT BIT_LENGTH($col_type),
947 $col_type, id FROM t1_values';
948 --source suite/funcs_1/views/fv1.inc
949 let $col_type= my_binary_30;
950 eval SET @my_select =
'SELECT BIT_LENGTH($col_type),
951 $col_type, id FROM t1_values';
952 --source suite/funcs_1/views/fv1.inc
953 let $col_type= my_varbinary_1000;
954 eval SET @my_select =
'SELECT BIT_LENGTH($col_type),
955 $col_type, id FROM t1_values';
956 --source suite/funcs_1/views/fv1.inc
960 # 3.5. CHAR_LENGTH(str)
961 # 3.6 CHARACTER_LENGTH(str)
962 # CHARACTER_LENGTH() is a synonym for CHAR_LENGTH().
963 # 3.7. COMPRESS(string_to_compress)
964 # 3.8. CONCAT(str1,str2,...)
965 # 3.9. CONCAT_WS(separator,str1,str2,...)
966 # 3.10. CONV(N,from_base,to_base)
967 # 3.11. ELT(N,str1,str2,str3,...)
968 # 3.12. EXPORT_SET(bits,on,off[,separator[,number_of_bits]])
969 # 3.13. FIELD(str,str1,str2,str3,...)
970 # 3.14. FIND_IN_SET(str,strlist)
972 # 3.16. INSERT(str,pos,len,newstr)
973 # 3.17. INSTR(str,substr)
974 # This is the same as the two-argument form of LOCATE(),
975 # except that the arguments are swapped.
976 # The majority of the testcases should be made with LOCATE().
977 # Therefore test only one example here.
978 let $col_type= my_char_30;
979 eval SET @my_select =
'SELECT INSTR($col_type, ''char''),
980 $col_type, id FROM t1_values';
981 --source suite/funcs_1/views/fv2.inc
985 # LCASE() is a synonym for LOWER().
986 # The majority of the testcases should be made with LOWER().
987 # Therefore test only one example here.
988 let $col_type= my_varchar_1000;
989 eval SET @my_select =
'SELECT LCASE($col_type),
990 $col_type, id FROM t1_values';
991 --source suite/funcs_1/views/fv2.inc
994 # 3.19. LEFT(str,len)
995 # Returns the leftmost len characters from the string str.
996 let $col_type= my_char_30;
997 eval SET @my_select =
998 'SELECT LEFT($col_type, 2), $col_type, id FROM t1_values';
999 --source suite/funcs_1/views/fv1.inc
1000 let $col_type= my_varchar_1000;
1001 eval SET @my_select =
1002 'SELECT LEFT($col_type, 2), $col_type, id FROM t1_values';
1003 --source suite/funcs_1/views/fv1.inc
1004 let $col_type= my_binary_30;
1005 eval SET @my_select =
1006 'SELECT LEFT($col_type, 2), $col_type, id FROM t1_values';
1007 --source suite/funcs_1/views/fv1.inc
1008 let $col_type= my_varbinary_1000;
1009 eval SET @my_select =
1010 'SELECT LEFT($col_type, 2), $col_type, id FROM t1_values';
1011 --source suite/funcs_1/views/fv1.inc
1012 # Bug#11728 string function LEFT, strange undocumented behaviour, strict mode
1013 # Bug#10963 LEFT string function returns wrong result with large length
1014 let $col_type= my_bigint;
1015 eval SET @my_select =
1016 'SELECT LEFT(''AaBbCcDdEeFfGgHhIiJjÄäÜüÖö'', $col_type), $col_type, id FROM t1_values';
1017 --source suite/funcs_1/views/fv1.inc
1019 eval SET @my_select =
1020 'SELECT LEFT(''AaBbCcDdEeFfGgHhIiJjÄäÜüÖö'', $col_type), $col_type, id FROM t1_values';
1021 --source suite/funcs_1/views/fv1.inc
1022 # Bug#10963 LEFT string function returns wrong result with large length
1023 let $col_type= my_double;
1024 eval SET @my_select =
1025 'SELECT LEFT(''AaBbCcDdEeFfGgHhIiJjÄäÜüÖö'', $col_type), $col_type, id FROM t1_values';
1026 --source suite/funcs_1/views/fv1.inc
1029 let $col_type= my_char_30;
1030 eval SET @my_select =
'SELECT LENGTH($col_type),
1031 $col_type, id FROM t1_values';
1032 --source suite/funcs_1/views/fv2.inc
1033 let $col_type= my_varchar_1000;
1034 eval SET @my_select =
'SELECT LENGTH($col_type),
1035 $col_type, id FROM t1_values';
1036 --source suite/funcs_1/views/fv2.inc
1037 let $col_type= my_binary_30;
1038 eval SET @my_select =
'SELECT LENGTH($col_type),
1039 $col_type, id FROM t1_values';
1040 --source suite/funcs_1/views/fv2.inc
1041 let $col_type= my_varbinary_1000;
1042 eval SET @my_select =
'SELECT LENGTH($col_type),
1043 $col_type, id FROM t1_values';
1044 --source suite/funcs_1/views/fv2.inc
1047 # 3.21. LOAD_FILE(file_name)
1048 # Reads the file and returns the file contents as a string.
1049 # If the file doesn't exist or cannot be read ... ,
1050 # the function returns NULL.
1052 --replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
1053 eval SET @my_select =
1054 'SELECT LOAD_FILE(''$MYSQLTEST_VARDIR/std_data/funcs_1/load_file.txt'')
1057 --source suite/funcs_1/views/fv1.inc
1060 # 3.22. LOCATE(substr,str) , LOCATE(substr,str,pos)
1061 let $col_type= my_char_30;
1062 eval SET @my_select =
'SELECT LOCATE(''char'', $col_type),
1063 $col_type, id FROM t1_values';
1064 --source suite/funcs_1/views/fv2.inc
1065 let $col_type= my_varchar_1000;
1066 eval SET @my_select =
'SELECT LOCATE(''char'', $col_type),
1067 $col_type, id FROM t1_values';
1068 --source suite/funcs_1/views/fv2.inc
1069 let $col_type= my_binary_30;
1070 eval SET @my_select =
'SELECT LOCATE(''char'', $col_type),
1071 $col_type, id FROM t1_values';
1072 --source suite/funcs_1/views/fv2.inc
1073 let $col_type= my_varbinary_1000;
1074 eval SET @my_select =
'SELECT LOCATE(''char'', $col_type),
1075 $col_type, id FROM t1_values';
1076 --source suite/funcs_1/views/fv2.inc
1077 #------------------------------------------------------
1078 let $col_type1= my_char_30;
1080 eval SET @my_select =
'SELECT LOCATE($col_type1, $col_type1 ),
1081 $col_type1, id FROM t1_values';
1082 --source suite/funcs_1/views/fv2.inc
1083 let $col_type2= my_varchar_1000;
1084 eval SET @my_select =
'SELECT LOCATE($col_type1, $col_type2 ),
1085 $col_type1, $col_type2 id FROM t1_values';
1086 --source suite/funcs_1/views/fv2.inc
1087 let $col_type2= my_binary_30;
1088 eval SET @my_select =
'SELECT LOCATE($col_type1, $col_type2 ),
1089 $col_type1, $col_type2 id FROM t1_values';
1090 --source suite/funcs_1/views/fv2.inc
1091 let $col_type2= my_varbinary_1000;
1092 eval SET @my_select =
'SELECT LOCATE($col_type1, $col_type2 ),
1093 $col_type1, $col_type2 id FROM t1_values';
1094 --source suite/funcs_1/views/fv2.inc
1095 #------------------------------------------------------
1096 let $col_type1= my_varchar_1000;
1098 eval SET @my_select =
'SELECT LOCATE($col_type1, $col_type1 ),
1099 $col_type1, id FROM t1_values';
1100 --source suite/funcs_1/views/fv2.inc
1101 let $col_type2= my_char_30;
1102 eval SET @my_select =
'SELECT LOCATE($col_type1, $col_type2 ),
1103 $col_type1, $col_type2 id FROM t1_values';
1104 --source suite/funcs_1/views/fv2.inc
1105 let $col_type2= my_binary_30;
1106 eval SET @my_select =
'SELECT LOCATE($col_type1, $col_type2 ),
1107 $col_type1, $col_type2 id FROM t1_values';
1108 --source suite/funcs_1/views/fv2.inc
1109 let $col_type2= my_varbinary_1000;
1110 eval SET @my_select =
'SELECT LOCATE($col_type1, $col_type2 ),
1111 $col_type1, $col_type2 id FROM t1_values';
1112 --source suite/funcs_1/views/fv2.inc
1113 #------------------------------------------------------
1114 let $col_type1= my_binary_30;
1116 eval SET @my_select =
'SELECT LOCATE($col_type1, $col_type1 ),
1117 $col_type1, id FROM t1_values';
1118 --source suite/funcs_1/views/fv2.inc
1119 let $col_type2= my_char_30;
1120 eval SET @my_select =
'SELECT LOCATE($col_type1, $col_type2 ),
1121 $col_type1, $col_type2 id FROM t1_values';
1122 --source suite/funcs_1/views/fv2.inc
1123 let $col_type2= my_varchar_1000;
1124 eval SET @my_select =
'SELECT LOCATE($col_type1, $col_type2 ),
1125 $col_type1, $col_type2 id FROM t1_values';
1126 --source suite/funcs_1/views/fv2.inc
1127 let $col_type2= my_varbinary_1000;
1128 eval SET @my_select =
'SELECT LOCATE($col_type1, $col_type2 ),
1129 $col_type1, $col_type2 id FROM t1_values';
1130 --source suite/funcs_1/views/fv2.inc
1131 #------------------------------------------------------
1132 let $col_type1= my_varbinary_1000;
1134 eval SET @my_select =
'SELECT LOCATE($col_type1, $col_type1 ),
1135 $col_type1, id FROM t1_values';
1136 --source suite/funcs_1/views/fv2.inc
1137 let $col_type2= my_char_30;
1138 eval SET @my_select =
'SELECT LOCATE($col_type1, $col_type2 ),
1139 $col_type1, $col_type2 id FROM t1_values';
1140 --source suite/funcs_1/views/fv2.inc
1141 let $col_type2= my_varchar_1000;
1142 eval SET @my_select =
'SELECT LOCATE($col_type1, $col_type2 ),
1143 $col_type1, $col_type2 id FROM t1_values';
1144 --source suite/funcs_1/views/fv2.inc
1145 let $col_type2= my_binary_30;
1146 eval SET @my_select =
'SELECT LOCATE($col_type1, $col_type2 ),
1147 $col_type1, $col_type2 id FROM t1_values';
1148 --source suite/funcs_1/views/fv2.inc
1150 # FIXME How to test exotic or interesting substr values like NULL, '', ' '
1151 # without getting too much result rows
1152 # FIXME Testcases with LOCATE(substr,str,pos)
1153 let $col_type= my_char_30;
1154 eval SET @my_select =
'SELECT LOCATE(''-'', $col_type, 3),
1155 $col_type, id FROM t1_values';
1156 --source suite/funcs_1/views/fv2.inc
1157 let $col_type= my_varchar_1000;
1158 eval SET @my_select =
'SELECT LOCATE(''-'', $col_type, 3),
1159 $col_type, id FROM t1_values';
1160 --source suite/funcs_1/views/fv2.inc
1161 let $col_type= my_binary_30;
1162 eval SET @my_select =
'SELECT LOCATE(''-'', $col_type, 3),
1163 $col_type, id FROM t1_values';
1164 --source suite/funcs_1/views/fv2.inc
1165 let $col_type= my_varbinary_1000;
1166 eval SET @my_select =
'SELECT LOCATE(''-'', $col_type, 3),
1167 $col_type, id FROM t1_values';
1168 --source suite/funcs_1/views/fv2.inc
1169 #--------------------------------------------------------
1170 let $col_type= my_bigint;
1171 eval SET @my_select =
'SELECT LOCATE(''-'', '' - -ABC'', $col_type),
1172 $col_type, id FROM t1_values';
1173 --source suite/funcs_1/views/fv2.inc
1174 let $col_type= my_double;
1175 eval SET @my_select =
'SELECT LOCATE(''-'', '' - -ABC'', $col_type),
1176 $col_type, id FROM t1_values';
1177 --source suite/funcs_1/views/fv2.inc
1179 eval SET @my_select =
'SELECT LOCATE(''-'', '' - -ABC'', $col_type),
1180 $col_type, id FROM t1_values';
1181 --source suite/funcs_1/views/fv2.inc
1185 let $col_type= my_char_30;
1186 eval SET @my_select =
'SELECT LOWER($col_type),
1187 $col_type, id FROM t1_values';
1188 --source suite/funcs_1/views/fv2.inc
1189 let $col_type= my_varchar_1000;
1190 eval SET @my_select =
'SELECT LOWER($col_type),
1191 $col_type, id FROM t1_values';
1192 --source suite/funcs_1/views/fv2.inc
1193 let $col_type= my_binary_30;
1194 eval SET @my_select =
'SELECT LOWER($col_type),
1195 $col_type, id FROM t1_values';
1196 --source suite/funcs_1/views/fv2.inc
1197 let $col_type= my_varbinary_1000;
1198 eval SET @my_select =
'SELECT LOWER($col_type),
1199 $col_type, id FROM t1_values';
1200 --source suite/funcs_1/views/fv2.inc
1203 # 3.24. LPAD(str,len,padstr)
1205 let $col_type= my_char_30;
1206 eval SET @my_select =
'SELECT LTRIM($col_type),
1207 $col_type, id FROM t1_values';
1208 --source suite/funcs_1/views/fv2.inc
1209 let $col_type= my_varchar_1000;
1210 eval SET @my_select =
'SELECT LTRIM($col_type),
1211 $col_type, id FROM t1_values';
1212 --source suite/funcs_1/views/fv2.inc
1213 let $col_type= my_binary_30;
1214 eval SET @my_select =
'SELECT LTRIM($col_type),
1215 $col_type, id FROM t1_values';
1216 --source suite/funcs_1/views/fv2.inc
1217 let $col_type= my_varbinary_1000;
1218 eval SET @my_select =
'SELECT LTRIM($col_type),
1219 $col_type, id FROM t1_values';
1220 --source suite/funcs_1/views/fv2.inc
1223 # 3.26. MAKE_SET(bits,str1,str2,...)
1225 # FIXME: to be implemented
1227 ################################################################################
1228 # Please do not add SELECTs and interesting records after this line. #
1229 # These last SELECTs are mostly for checking the testcase code itself. #
1230 ################################################################################
1231 eval SET @my_select =
1232 'SELECT CONCAT(''A'',my_char_30), my_char_30, id FROM t1_values'; #
1233 --source suite/funcs_1/views/fv1.inc
1235 eval SET @my_select =
'SELECT my_char_30, id FROM t1_values'; #
1236 --source suite/funcs_1/views/fv2.inc
1237 eval INSERT INTO t1_values SET select_id = @select_id,
1238 my_char_30 =
'Viana do Castelo';
1239 ################################################################################
1240 SET sql_mode =
''; #
1242 ##### END Basic preparations #######################################
1245 let $message=
"# The basic preparations end and the main test starts here";
1246 --source include/show_msg80.inc
1248 --disable_ps_protocol
1250 ##### The tests start here #####################################################
1252 # Determine the number of different SELECTs to be checked
1254 SELECT COUNT(*) INTO @num_selects FROM t1_selects;
1257 # SELECT @num_selects AS "number of SELECTS:";
1259 --disable_abort_on_error
1260 let $select_id= `SELECT @num_selects`;
1263 # Determine the SELECT
1265 eval SELECT my_select, disable_result INTO @my_select, @disable_result
1266 FROM t1_selects WHERE
id = $select_id;
1267 let $run_no_result= `SELECT @disable_result =
'Yes'`;
1270 # SELECT @my_select AS "SELECT:";
1271 let $my_select= `SELECT @my_select`;
1274 if ($view_select_result)
1277 --replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
1278 eval CREATE VIEW v1 AS $my_select;
1280 eval
set @got_errno= $mysql_errno ;
1281 let $run0= `SELECT @got_errno = 0`;
1286 --echo Attention: The last CREATE VIEW failed
1291 # FIXME The loop over the modes will start here.
1293 if ($simple_select_result)
1295 # Simple SELECT on the base table of the VIEW for comparison
1299 --disable_result_log
1301 --replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
1303 WHERE select_id = $select_id OR select_id IS NULL order by
id;
1311 --echo Attention: The last SELECT on the base
table failed
1316 # $run0 is 1, if CREATE VIEW was successful.
1317 # That means SHOW CREATE VIEW/SELECT/DROP should be executed.
1320 # Check the CREATE VIEW statement
1321 --replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
1322 SHOW CREATE VIEW v1;
1326 --echo Attention: The last SHOW CREATE VIEW failed
1330 # Maybe a Join is faster
1333 --disable_result_log
1335 eval SELECT v1.* FROM v1
1336 WHERE v1.id IN (SELECT
id FROM t1_values
1337 WHERE select_id = $select_id OR select_id IS NULL) order by
id;
1345 --echo Attention: The last SELECT from VIEW failed
1352 # FIXME The loop over the modes will end here.
1354 # Produce two empty lines as separator between different SELECTS
1362 --enable_ps_protocol
1364 DROP
TABLE t1_selects, t1_modes, t1_values;