summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/gcol/t/gcol_keys_innodb.test
blob: 7f7c4503108219e9ccdda7f4e2d2b98b1d221ee7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
################################################################################
# t/gcol_keys_innodb.test                                                      #
#                                                                              #
# Purpose:                                                                     #
#  Testing keys, indexes defined upon generated columns.                       #
#                                                                              #
#        InnoDB branch                                                         #
#                                                                              #
#------------------------------------------------------------------------------#
# Original Author: Andrey Zhakov                                               #
# Original Date: 2008-09-04                                                    #
# Change Author:                                                               #
# Change Date:                                                                 #
# Change:                                                                      #
################################################################################

#
# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
#       TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
#       THE SOURCED FILES ONLY.
#

#------------------------------------------------------------------------------#
# General not engine specific settings and requirements

#------------------------------------------------------------------------------#
# Engine specific settings and requirements

##### Storage engine to be tested
# Set the session storage engine
--source include/have_innodb.inc
eval SET @@session.default_storage_engine = 'InnoDB';

##### Workarounds for known open engine specific bugs
#     none

#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
let $skip_spatial_index_check = 1;
let $support_virtual_index= 1;
--source suite/gcol/inc/gcol_keys.inc

if ($support_virtual_index) {
#------------------------------------------------------------------------------#
# Execute storage engine specific tests
--echo #
--echo # BUG#21365158 WL8149:ASSERTION `!TABLE || (!TABLE->WRITE_SET
--echo #
CREATE TABLE t1 (
  pk INTEGER AUTO_INCREMENT,
  col_int_nokey INTEGER NOT NULL,
  col_varchar_nokey VARCHAR(1),
  col_varchar_key VARCHAR(2) GENERATED ALWAYS AS
    (CONCAT(col_varchar_nokey, col_varchar_nokey)) VIRTUAL,
  PRIMARY KEY (pk)
);

INSERT INTO t1 ( col_int_nokey, col_varchar_nokey)
VALUES (4, 'b'),(9, 'o'),(4, 'k'),(5, 'a'),(5, 'f'),
(9, 't'),(3, 'c'),(8, 'c'),(0, 'r'),(98, 'k');

CREATE TABLE t2 (
  pk INTEGER AUTO_INCREMENT,
  col_int_nokey INTEGER NOT NULL,
  col_varchar_nokey VARCHAR(1) NOT NULL,
  col_varchar_key VARCHAR(2) GENERATED ALWAYS AS
    (CONCAT(col_varchar_nokey, col_varchar_nokey)) VIRTUAL,
  PRIMARY KEY (pk),
  UNIQUE KEY (col_varchar_key)
);

INSERT INTO t2 ( col_int_nokey, col_varchar_nokey)
VALUES (1, 'c'),(8, 'm'),(9, 'd'), (6, 'y'),(1, 't'),
(2, 's'),(4, 'r');

SELECT
  CONCAT( t2.col_varchar_nokey , t2.col_varchar_nokey ) AS f2,
  t1.col_varchar_key AS f5
FROM
  t2 LEFT JOIN t1 ON t2.col_int_nokey > t1.col_int_nokey
ORDER BY f2, f5;
DROP TABLE t1,t2;

--echo #

}
#------------------------------------------------------------------------------#
# Cleanup
--source suite/gcol/inc/gcol_cleanup.inc