config root man

Current Path : /usr/opt/mysql57/mysql-test/suite/gcol/r/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : //usr/opt/mysql57/mysql-test/suite/gcol/r/gcol_bugfixes.result

# Bug#21230709: Alter table statement fails with division by zero
CREATE TABLE t1 (
col1 INTEGER NOT NULL,
col2 INTEGER NOT NULL,
col3 INTEGER NOT NULL,
gcol1 INTEGER GENERATED ALWAYS AS (col3 + col3) VIRTUAL,
col4 INTEGER DEFAULT NULL,
col5 INTEGER DEFAULT NULL,
col6 INTEGER DEFAULT NULL,
col7 INTEGER DEFAULT NULL,
col8 INTEGER DEFAULT NULL,
col9 INTEGER DEFAULT NULL,
col10 INTEGER DEFAULT NULL,
col11 INTEGER DEFAULT NULL,
col12 INTEGER DEFAULT NULL,
col13 INTEGER DEFAULT NULL,
col14 INTEGER DEFAULT NULL,
col15 INTEGER DEFAULT NULL,
col16 INTEGER DEFAULT NULL,
col17 INTEGER DEFAULT NULL,
col18 INTEGER DEFAULT NULL,
col19 INTEGER DEFAULT NULL,
col20 INTEGER DEFAULT NULL,
col21 INTEGER DEFAULT NULL,
col22 INTEGER DEFAULT NULL,
col23 INTEGER DEFAULT NULL,
col24 INTEGER DEFAULT NULL,
col25 INTEGER DEFAULT NULL,
col26 INTEGER DEFAULT NULL,
col27 INTEGER DEFAULT NULL,
col28 INTEGER DEFAULT NULL,
col29 INTEGER DEFAULT NULL,
col30 INTEGER DEFAULT NULL,
col31 INTEGER DEFAULT NULL,
col32 INTEGER DEFAULT NULL,
col33 INTEGER DEFAULT NULL,
gcol2 INTEGER GENERATED ALWAYS AS (col2 + col2) VIRTUAL,
gcol3 INTEGER GENERATED ALWAYS AS (gcol2 / gcol2) VIRTUAL,
PRIMARY KEY (col1),
KEY idx1 (gcol1)
) engine=innodb;
INSERT INTO t1 (col1, col2, col3)
VALUES (0,1,2), (1,2,3), (2,3,4), (3,4,5), (4,5,6);
FLUSH TABLE t1;
ALTER TABLE t1 ADD COLUMN extra INTEGER;
DROP TABLE t1;
#
# Bug 21340801 WL8149:ASSERTION `IS_VIRTUAL_GCOL()' FAILED
#
CREATE TABLE t1 (
c_blob BLOB,
c_blob_key BLOB GENERATED ALWAYS AS (REPEAT(c_blob,15)) STORED,
KEY (c_blob_key(200))
);
INSERT  INTO t1 (c_blob) VALUES ('xceks');
DROP TABLE t1;
#
# Bug#21345972 WL8149:JOIN_CACHE::FILTER_VIRTUAL_GCOL_BASE_COLS(): ASSERTION `FALSE' FAILED.
#
CREATE TABLE c (
pk INTEGER AUTO_INCREMENT,
col_int_nokey INTEGER /*! NULL */,
col_int_key INTEGER GENERATED ALWAYS AS
(col_int_nokey + col_int_nokey) VIRTUAL not null,
col_date_nokey DATE /*! NULL */,
col_date_key DATE GENERATED ALWAYS AS
(DATE_ADD(col_date_nokey,interval 30 day)) VIRTUAL not null,
col_datetime_nokey DATETIME /*! NULL */,
col_time_nokey TIME /*! NULL */,
col_datetime_key DATETIME GENERATED ALWAYS AS
(ADDTIME(col_datetime_nokey, col_time_nokey)) VIRTUAL not null,
col_time_key TIME GENERATED ALWAYS AS
(ADDTIME(col_datetime_nokey, col_time_nokey)) VIRTUAL not null,
col_varchar_nokey VARCHAR(1) /*! NULL */,
col_varchar_key VARCHAR(2) GENERATED ALWAYS AS
(CONCAT(col_varchar_nokey, col_varchar_nokey)) VIRTUAL not null,
PRIMARY KEY (pk),
UNIQUE KEY (col_int_key),
UNIQUE KEY (col_varchar_key),
UNIQUE KEY (col_date_key),
KEY (col_time_key),
KEY (col_datetime_key),
UNIQUE KEY (col_int_key, col_varchar_key),
KEY (col_int_key, col_int_nokey),
KEY(col_int_key,col_date_key),
KEY(col_int_key, col_time_key),
KEY(col_int_key, col_datetime_key),
UNIQUE
KEY(col_date_key,col_time_key,col_datetime_key),
UNIQUE KEY (col_varchar_key, col_varchar_nokey),
UNIQUE KEY (col_int_key, col_varchar_key,
col_date_key, col_time_key, col_datetime_key)
)  ENGINE=INNODB;
INSERT /*! IGNORE */ INTO c (
col_int_nokey,
col_date_nokey,
col_time_nokey,
col_datetime_nokey,
col_varchar_nokey
) VALUES (7, '2004-04-09', '14:03:03.042673',
'2001-11-28 00:50:27.051028', 'c'),(1, '2006-05-13', '01:46:09.016386',
'2007-10-09 19:53:04.008332', NULL);
Warnings:
Warning	1048	Column 'col_varchar_key' cannot be null
CREATE TABLE bb (
pk INTEGER AUTO_INCREMENT,
col_int_nokey INTEGER /*! NULL */,
col_int_key INTEGER GENERATED ALWAYS AS
(col_int_nokey + col_int_nokey) VIRTUAL not null,
col_date_nokey DATE /*! NULL */,
col_date_key DATE GENERATED ALWAYS AS
(DATE_ADD(col_date_nokey,interval 30 day)) VIRTUAL not null,
col_datetime_nokey DATETIME /*! NULL */,
col_time_nokey TIME /*! NULL */,
col_datetime_key DATETIME GENERATED ALWAYS AS
(ADDTIME(col_datetime_nokey, col_time_nokey)) VIRTUAL not null,
col_time_key TIME GENERATED ALWAYS AS
(ADDTIME(col_datetime_nokey, col_time_nokey)) VIRTUAL not null,
col_varchar_nokey VARCHAR(1) /*! NULL */,
col_varchar_key VARCHAR(2) GENERATED ALWAYS AS
(CONCAT(col_varchar_nokey, col_varchar_nokey)) VIRTUAL not null,
PRIMARY KEY (pk),
UNIQUE KEY (col_int_key),
UNIQUE KEY (col_varchar_key),
UNIQUE KEY (col_date_key),
KEY (col_time_key),
KEY (col_datetime_key),
UNIQUE KEY (col_int_key, col_varchar_key),
KEY (col_int_key, col_int_nokey),
KEY(col_int_key,col_date_key),
KEY(col_int_key, col_time_key),
KEY(col_int_key, col_datetime_key),
UNIQUE
KEY(col_date_key,col_time_key,col_datetime_key),
UNIQUE KEY (col_varchar_key, col_varchar_nokey),
UNIQUE KEY (col_int_key, col_varchar_key,
col_date_key, col_time_key, col_datetime_key)
)  AUTO_INCREMENT=10 ENGINE=INNODB;
INSERT /*! IGNORE */ INTO bb (
col_int_nokey,
col_date_nokey,
col_time_nokey,
col_datetime_nokey,
col_varchar_nokey
) VALUES (0, '2003-08-04', '01:48:05.048577',
'2006-11-03 00:00:00', 'p'),(2, '2007-11-06', '00:00:00', '2009-11-26 19:28:11.005115', 'n');
CREATE TABLE cc (
pk INTEGER AUTO_INCREMENT,
col_int_nokey INTEGER /*! NULL */,
col_int_key INTEGER GENERATED ALWAYS AS
(col_int_nokey + col_int_nokey) VIRTUAL not null,
col_date_nokey DATE /*! NULL */,
col_date_key DATE GENERATED ALWAYS AS
(DATE_ADD(col_date_nokey,interval 30 day)) VIRTUAL not null,
col_datetime_nokey DATETIME /*! NULL */,
col_time_nokey TIME /*! NULL */,
col_datetime_key DATETIME GENERATED ALWAYS AS
(ADDTIME(col_datetime_nokey, col_time_nokey)) VIRTUAL not null,
col_time_key TIME GENERATED ALWAYS AS
(ADDTIME(col_datetime_nokey, col_time_nokey)) VIRTUAL not null,
col_varchar_nokey VARCHAR(1) /*! NULL */,
col_varchar_key VARCHAR(2) GENERATED ALWAYS AS
(CONCAT(col_varchar_nokey, col_varchar_nokey)) VIRTUAL not null,
PRIMARY KEY (pk),
UNIQUE KEY (col_int_key),
UNIQUE KEY (col_varchar_key),
UNIQUE KEY (col_date_key),
KEY (col_time_key),
KEY (col_datetime_key),
UNIQUE KEY (col_int_key, col_varchar_key),
KEY (col_int_key, col_int_nokey),
KEY(col_int_key,col_date_key),
KEY(col_int_key, col_time_key),
KEY(col_int_key, col_datetime_key),
UNIQUE
KEY(col_date_key,col_time_key,col_datetime_key),
UNIQUE KEY (col_varchar_key, col_varchar_nokey),
UNIQUE KEY (col_int_key, col_varchar_key,
col_date_key, col_time_key, col_datetime_key)
)  AUTO_INCREMENT=10 ENGINE=INNODB;
INSERT /*! IGNORE */ INTO cc (
col_int_nokey,
col_date_nokey,
col_time_nokey,
col_datetime_nokey,
col_varchar_nokey
) VALUES (172, '2009-04-23', '00:00:00', '2000-12-07 10:17:40.013275', 'h'),(NULL, '2002-10-06', '00:50:49.017545', NULL, 'm');
Warnings:
Warning	1048	Column 'col_int_key' cannot be null
Warning	1048	Column 'col_datetime_key' cannot be null
Warning	1048	Column 'col_time_key' cannot be null
EXPLAIN SELECT
gp1 . col_datetime_key AS g1
FROM cc AS gp1 LEFT JOIN c AS gp2 ON ( gp2 . col_datetime_key <> gp1 .
col_time_nokey )
WHERE
gp1 . col_varchar_nokey IN
(
SELECT
DISTINCT p1 . col_varchar_key AS p1
FROM bb AS p1 LEFT JOIN bb AS p2
ON ( p1 . col_int_key = p2 . pk )
)
AND gp1 . col_varchar_nokey = 'b'
HAVING g1 > 6;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	gp1	NULL	ALL	NULL	NULL	NULL	NULL	2	50.00	Using where
1	SIMPLE	p1	NULL	const	col_varchar_key,col_varchar_key_2	col_varchar_key	4	const	1	100.00	NULL
1	SIMPLE	p2	NULL	eq_ref	PRIMARY	PRIMARY	4	test.p1.col_int_key	1	100.00	Using index; FirstMatch(gp1)
1	SIMPLE	gp2	NULL	index	NULL	col_datetime_key	5	NULL	2	100.00	Using where; Using index; Using join buffer (Block Nested Loop)
Warnings:
Warning	1292	Incorrect datetime value: '6' for column 'col_datetime_key' at row 1
Note	1003	/* select#1 */ select `test`.`gp1`.`col_datetime_key` AS `g1` from `test`.`cc` `gp1` semi join (`test`.`bb` `p1` left join `test`.`bb` `p2` on((`test`.`p1`.`col_int_key` = `test`.`p2`.`pk`))) left join `test`.`c` `gp2` on((`test`.`gp2`.`col_datetime_key` <> `test`.`gp1`.`col_time_nokey`)) where ((`test`.`gp1`.`col_varchar_nokey` = 'b') and ('b' = `test`.`p1`.`col_varchar_key`)) having (`g1` > 6)
SELECT
gp1 . col_datetime_key AS g1
FROM cc AS gp1 LEFT JOIN c AS gp2 ON ( gp2 . col_datetime_key <> gp1 .
col_time_nokey )
WHERE
gp1 . col_varchar_nokey IN
(
SELECT
DISTINCT p1 . col_varchar_key AS p1
FROM bb AS p1 LEFT JOIN bb AS p2
ON ( p1 . col_int_key = p2 . pk )
)
AND gp1 . col_varchar_nokey = 'b'
HAVING g1 > 6;
g1
Warnings:
Warning	1292	Incorrect datetime value: '6' for column 'col_datetime_key' at row 1
DROP TABLE bb, c, cc;
# Bug#21284646: Assertion !(table || table->read_set || bitmap_is_set())
CREATE TABLE c (
pk INTEGER AUTO_INCREMENT,
col_int_nokey INTEGER NOT NULL,
col_int_key INTEGER GENERATED ALWAYS AS (col_int_nokey + col_int_nokey) VIRTUAL not null,
col_date_nokey DATE NOT NULL,
col_date_key DATE GENERATED ALWAYS AS (DATE_ADD(col_date_nokey,interval 30 day)) VIRTUAL not null,
col_datetime_nokey DATETIME NOT NULL,
col_time_nokey TIME NOT NULL,
col_datetime_key DATETIME GENERATED ALWAYS AS (ADDTIME(col_datetime_nokey, col_time_nokey)) VIRTUAL not null,
col_time_key TIME GENERATED ALWAYS AS (ADDTIME(col_datetime_nokey, col_time_nokey)) VIRTUAL 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 not null,
PRIMARY KEY (pk,col_int_nokey),
UNIQUE KEY (col_int_key),
UNIQUE KEY (col_varchar_key),
UNIQUE KEY (col_date_key),
KEY (col_time_key),
KEY (col_datetime_key),
UNIQUE KEY (col_int_key, col_varchar_key),
KEY (col_int_key, col_int_nokey),
KEY(col_int_key,col_date_key),
KEY(col_int_key, col_time_key),
KEY(col_int_key, col_datetime_key),
UNIQUE KEY (col_date_key,col_time_key,col_datetime_key),
UNIQUE KEY (col_varchar_key, col_varchar_nokey),
UNIQUE KEY (col_int_key, col_varchar_key, col_date_key, col_time_key, col_datetime_key)
)  ENGINE=INNODB;
INSERT INTO c (col_int_nokey, col_date_nokey, col_time_nokey, col_datetime_nokey, col_varchar_nokey) VALUES
(1, '2009-12-01', '00:21:38.058143', '2007-05-28 00:00:00', 'c'),
(8, '2004-12-17', '04:08:02.046897', '2009-07-25 09:21:20.064099', 'm'),
(9, '2000-03-14', '16:25:11.040240', '2002-01-16 00:00:00', 'd'),
(6, '2006-05-25', '19:47:59.011283', '2001-02-15 03:08:38.035426', 'y'),
(2, '2002-10-13', '00:00:00', '1900-01-01 00:00:00', 's'),
(4, '1900-01-01', '15:57:25.019666', '2005-08-15 00:00:00', 'r');
ANALYZE TABLE c;
Table	Op	Msg_type	Msg_text
test.c	analyze	status	OK
explain SELECT COUNT(DISTINCT col_varchar_key) AS x
FROM c
WHERE col_varchar_key IN ('rr', 'rr') OR
col_int_nokey <> 9 AND
pk >= 8
HAVING x > '2000-02-06'
ORDER BY col_time_nokey, pk;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	c	NULL	index_merge	PRIMARY,col_varchar_key,col_int_key_2,col_varchar_key_2,col_int_key_7	col_varchar_key,PRIMARY	4,4	NULL	2	100.00	Using sort_union(col_varchar_key,PRIMARY); Using where
Warnings:
Note	1003	/* select#1 */ select count(distinct `test`.`c`.`col_varchar_key`) AS `x` from `test`.`c` where ((`test`.`c`.`col_varchar_key` in ('rr','rr')) or ((`test`.`c`.`col_int_nokey` <> 9) and (`test`.`c`.`pk` >= 8))) having (`x` > '2000-02-06')
SELECT COUNT(DISTINCT col_varchar_key) AS x
FROM c
WHERE col_varchar_key IN ('rr', 'rr') OR
col_int_nokey <> 9 AND
pk >= 8
HAVING x > '2000-02-06'
ORDER BY col_time_nokey, pk;
x
Warnings:
Warning	1292	Truncated incorrect DOUBLE value: '2000-02-06'
DROP TABLE c;
# Bug#21341044: Conditional jump at sort_param::make_sort_key
CREATE TABLE t1 (
pk INTEGER AUTO_INCREMENT,
col_int_nokey INTEGER /*! NULL */,
col_int_key INTEGER GENERATED ALWAYS AS (col_int_nokey + col_int_nokey) VIRTUAL,
col_blob_nokey BLOB /*! NULL */,
col_blob_key BLOB GENERATED ALWAYS AS (REPEAT(col_blob_nokey,15)) VIRTUAL,
col_longblob_nokey LONGBLOB /*! NULL */,
col_longtext_nokey LONGTEXT /*! NULL */,
col_longblob_key LONGBLOB GENERATED ALWAYS AS (REPEAT(col_longblob_nokey, 20)) VIRTUAL,
col_longtext_key LONGTEXT GENERATED ALWAYS AS (REPEAT(col_longblob_nokey, 18)) VIRTUAL,
col_text_nokey TEXT /*! NULL */,
col_text_key TEXT GENERATED ALWAYS AS (REPEAT(col_text_nokey, 30)) VIRTUAL,
PRIMARY KEY (pk),
KEY (col_int_key),
KEY (col_text_key(50)),
KEY (col_blob_key(200)),
KEY (col_longtext_key(200)),
KEY (col_longblob_key(200)),
KEY (col_int_key, col_text_key(100)),
KEY (col_int_key, col_longtext_key(100)),
KEY (col_int_key, col_blob_key(100)),
KEY (col_int_key, col_longblob_key(100)),
KEY (col_longtext_key(10), col_longblob_key(100)),
KEY (col_int_key, col_text_key(10), col_blob_key(100), col_longtext_key(50), col_longblob_key(50))
) engine=innodb;
INSERT INTO t1 (col_int_nokey,col_blob_nokey,col_longtext_nokey,col_longblob_nokey,col_text_nokey)
VALUES
(0, 'ijcszxw', 'ijcszxw', 'ijcszxw', 'ijcszxw'),
(5, 'jcszxwb', 'jcszxwb', 'jcszxwb', 'jcszxwb'),
(4, 'cszxwbjjvv', 'cszxwbjjvv', 'cszxwbjjvv', 'cszxwbjjvv'),
(3, 'szxw', 'szxw', 'szxw', 'szxw'),
(7, 'zxwb', 'zxwb', 'zxwb', 'zxwb'),
(42, 'xwbjjvvky', 'xwbjjvvky', 'xwbjjvvky', 'xwbjjvvky'),
(142, 'wbjj', 'wbjj', 'wbjj', 'wbjj'),
(5, 'bjjv', 'bjjv', 'bjjv', 'bjjv'),
(0, 'jjvvkymalu', 'jjvvkymalu', 'jjvvkymalu', 'jjvvkymalu'),
(3, 'j', 'j', 'j', 'j');
SELECT alias1.pk AS field1
FROM t1 AS alias1 LEFT OUTER JOIN t1 AS alias2
ON alias1.col_int_key = alias2.col_int_key
WHERE alias2.col_int_key BETWEEN 8 AND (8 + 1 ) OR
alias2.col_int_key  BETWEEN 8 AND (8 + 5 ) AND
alias2.col_int_key != 20 OR
alias2.col_int_key IN (8, 5, 8) AND
alias2.col_int_key >= 0 AND
alias2.col_int_key <= ( 8 + 75 ) AND
alias1.pk IS NOT NULL
ORDER BY field1;
field1
2
2
3
8
8
DROP TABLE t1;
# bug#21487651: gcols: memory leak after failed alter table
CREATE TABLE t(a int);
ALTER TABLE t ADD COLUMN b int GENERATED ALWAYS AS (
date_sub(a,interval a month)) VIRTUAL;
ALTER TABLE t ADD COLUMN c int GENERATED ALWAYS AS (sum(a));
ERROR HY000: Invalid use of group function
DROP TABLE t;
#
# Bug#21628840: CRASH/MEMORY CORRUPTION ADDING INDEXES TO VIRTUAL COLUMN
#               (II)
#
CREATE TABLE t1( a INT ) ENGINE = INNODB;
INSERT INTO t1( a ) VALUES ( 1 ), ( 2 ), ( 3 ), ( 4 ), ( 5 );
ALTER TABLE t1 ADD COLUMN b INT GENERATED ALWAYS AS (a - 1) STORED;
ALTER TABLE t1 ADD COLUMN c INT GENERATED ALWAYS AS (b + 1) VIRTUAL;
# Used to cause valgrind warning.
ALTER TABLE t1 ADD INDEX( c );
ANALYZE TABLE t1;
Table	Op	Msg_type	Msg_text
test.t1	analyze	status	OK
# Make sure the index is correct. That's kinda important.
EXPLAIN
SELECT c FROM t1;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	NULL	index	NULL	c	5	NULL	5	100.00	Using index
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`c` AS `c` from `test`.`t1`
SELECT c FROM t1;
c
1
2
3
4
5
DROP TABLE t1;
#
# Bug#21797776 ASSERTION `BIT < MAP->N_BITS' FAILED.
#
CREATE TABLE C (
col_int_1 INT,
col_int_2 INT GENERATED ALWAYS AS (col_int_1 + col_int_1) STORED,
col_int_3 INT GENERATED ALWAYS AS (col_int_2 + col_int_1) VIRTUAL
);
CREATE ALGORITHM=TEMPTABLE VIEW v1 AS
SELECT
col_int_2 AS field1, col_int_2 AS field2,
col_int_3 AS field3, col_int_3 AS field4
FROM C;
SELECT * FROM v1;
field1	field2	field3	field4
DROP TABLE C;
DROP VIEW v1;
#
# Bug#21613615 GCOLS: ASSERTION FAILED: !TABLE || (!TABLE->READ_SET || BITMAP_IS_SET
#
CREATE TABLE t (a INT);
CREATE TABLE v (
a INT,
c INT,
b CHAR(2) GENERATED ALWAYS AS (a IN (1)) VIRTUAL,
KEY(c,b(1)));
INSERT INTO v (a,c) VALUES (1,1);
EXPLAIN SELECT 1 FROM t WHERE ( SELECT 1 FROM t ) >=ANY( SELECT c FROM v );
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE
3	SUBQUERY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Select tables optimized away
2	SUBQUERY	t	NULL	ALL	NULL	NULL	NULL	NULL	1	100.00	NULL
Warnings:
Note	1003	/* select#1 */ select 1 AS `1` from `test`.`t` where 0
SELECT 1 FROM t WHERE ( SELECT 1 FROM t ) >=ANY( SELECT c FROM v );
1
EXPLAIN SELECT (SELECT MAX(c) FROM v);
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
2	SUBQUERY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Select tables optimized away
Warnings:
Note	1003	/* select#1 */ select (/* select#2 */ select max(`test`.`v`.`c`) from `test`.`v`) AS `(SELECT MAX(c) FROM v)`
SELECT (SELECT MAX(c) FROM v);
(SELECT MAX(c) FROM v)
1
DROP TABLE t, v;
CREATE TABLE v (
a INT,
c INT,
b CHAR(2) GENERATED ALWAYS AS (a IN (1)) VIRTUAL, KEY(c,b(1)));
INSERT INTO v (a,c) VALUES (1,1);
SELECT MAX(c), COUNT(b) FROM v;
MAX(c)	COUNT(b)
1	1
DROP TABLE v;
CREATE TABLE v (
a INT PRIMARY KEY,
b INT, KEY(b));
INSERT INTO v (a,b) VALUES (1,1);
SELECT MAX(a) FROM v WHERE b=1;
MAX(a)
1
DROP TABLE v;
#
# Bug#21824519: ASSERTION IN DROP TRIGGER WHEN TABLE HAS
#               VIRTUAL GENERATED COLUMN
#
CREATE TABLE t (a INT, b INT GENERATED ALWAYS AS (a) VIRTUAL);
CREATE TRIGGER tr BEFORE INSERT ON t FOR EACH ROW BEGIN END;
INSERT INTO t (a) VALUES (1);
SELECT * FROM t;
a	b
1	1
DROP TRIGGER tr;
SELECT * FROM t;
a	b
1	1
CREATE FUNCTION f() RETURNS INT RETURN (SELECT COUNT(*) FROM t);
SELECT f();
f()
1
DROP FUNCTION f;
SELECT * FROM t;
a	b
1	1
DROP TABLE t;
#
# Bug#21833760 CALC_DAYNR: ASSERTION `DELSUM+(INT) Y/4-TEMP >= 0' FAILED.
#
CREATE TABLE C(
c1 INT AUTO_INCREMENT,
c8 DATETIME,
c9 TIME,
c11 TIME GENERATED ALWAYS AS(ADDTIME(c8,c9)) VIRTUAL,
c13 TIME GENERATED ALWAYS AS(ADDTIME(c8,c11)) VIRTUAL,
PRIMARY KEY(c1),
UNIQUE KEY(c13)
);
INSERT INTO C (c8,c9) VALUES('1970-01-01',0),('1970-01-01',1);
CREATE VIEW view_C AS SELECT * FROM C;
SELECT /*+ NO_BNL(t1) */ t1.c13 FROM C AS t2 STRAIGHT_JOIN C AS t1 FORCE INDEX(c13);
c13
00:00:00
00:00:01
00:00:00
00:00:01
SELECT DISTINCT t1.c13 FROM C AS t1, view_C AS t2;
c13
00:00:00
00:00:01
DROP TABLE C;
DROP VIEW view_C;
#
# Bug #21808680: JSON + GENERATED COLUMN CORRUPTS TABLE CACHE
#                MEMORY, CRASHES
#
CREATE TABLE t (a INT, b JSON, c TEXT GENERATED ALWAYS AS (REPEAT(a=b, 2)));
INSERT INTO t (a, b) VALUES (1, '2'), (3, '3');
SELECT * FROM t;
a	b	c
1	2	00
3	3	11
DROP TABLE t;
#
# Bug#21810529: CRASH IN ITEM_FUNC::WALK WHEN CODE JUMPS TO GARBAGE
# LOCATION
#
CREATE TABLE t (a TIME,b INT GENERATED ALWAYS AS (a=1) VIRTUAL);
ALTER TABLE t CHANGE COLUMN q w INT;
ERROR 42S22: Unknown column 'q' in 't'
ALTER TABLE t CHANGE COLUMN q w INT;
ERROR 42S22: Unknown column 'q' in 't'
ALTER TABLE t CHANGE COLUMN q w INT;
ERROR 42S22: Unknown column 'q' in 't'
ALTER TABLE t CHANGE COLUMN q w INT;
ERROR 42S22: Unknown column 'q' in 't'
DROP TABLE t;
#
# Bug#21940542 TOO MUCH SPAM: INNODB: COMPUTE VIRTUAL COLUMN VALUES FAILED
#
CREATE TABLE t(b BLOB);
ALTER TABLE t ADD COLUMN c INT GENERATED ALWAYS AS ((1,1)) VIRTUAL;
ERROR HY000: Expression of generated column 'c' contains a disallowed function.
DROP TABLE t;
CREATE TABLE t(b BLOB, c INT GENERATED ALWAYS AS ((1,1)) VIRTUAL);
ERROR HY000: Expression of generated column 'c' contains a disallowed function.
#
# Bug#21929967 GCOLS: GCOL VALUE CHANGES WHEN SESSION CHANGES SQL_MODE
#
CREATE TABLE t1(a CHAR(1), b CHAR(1), c CHAR(2) AS (a || b));
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` char(1) DEFAULT NULL,
  `b` char(1) DEFAULT NULL,
  `c` char(2) GENERATED ALWAYS AS ((`a` or `b`)) VIRTUAL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
INSERT INTO t1 (a,b) VALUES('1','1');
SELECT * FROM t1;
a	b	c
1	1	1
SET SQL_MODE=PIPES_AS_CONCAT;
Warnings:
Warning	3090	Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release.
SELECT * FROM t1;
a	b	c
1	1	1
FLUSH TABLES;
SELECT * FROM t1;
a	b	c
1	1	1
DROP TABLE t1;
CREATE TABLE t1(a CHAR(1), b CHAR(1), c CHAR(2) AS (a || b));
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` char(1) DEFAULT NULL,
  `b` char(1) DEFAULT NULL,
  `c` char(2) GENERATED ALWAYS AS (concat(`a`,`b`)) VIRTUAL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
INSERT INTO t1 (a,b) VALUES('1','1');
SELECT * FROM t1;
a	b	c
1	1	11
SET SQL_MODE=DEFAULT;
SELECT * FROM t1;
a	b	c
1	1	11
FLUSH TABLES;
SELECT * FROM t1;
a	b	c
1	1	11
DROP TABLE t1;
# Bug#22018999: gcols: assertion failed: !error
SET @save_old_sql_mode= @@sql_mode;
SET sql_mode="";
Warnings:
Warning	3090	Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release.
CREATE TABLE t (a INTEGER AS (SUBSTR('','a',1))) engine=innodb;
ERROR 22007: Truncated incorrect INTEGER value: 'a'
CREATE TABLE t (a INTEGER) engine=innodb;
ALTER TABLE t ADD b INTEGER AS (SUBSTR('','a',1));
ERROR 22007: Truncated incorrect INTEGER value: 'a'
DROP TABLE t;
set sql_mode= @save_old_sql_mode;
Warnings:
Warning	3090	Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release.
# Bug#21875520 Problems with virtual column indexes
CREATE TABLE t(
a TIMESTAMP,
b BLOB,
c TIMESTAMP GENERATED ALWAYS AS (GREATEST(a, '2000-01-01 00:00:00')) VIRTUAL,
UNIQUE KEY(c)
);
INSERT INTO t(b) VALUES ('');
UPDATE t SET a='2001-01-01 00:00:00';
SELECT c FROM t;
c
2001-01-01 00:00:00
SELECT c, a FROM t;
c	a
2001-01-01 00:00:00	2001-01-01 00:00:00
UPDATE t SET b='xyz';
DO (SELECT @c1:= c FROM t);
DO (SELECT (@c2:= c) - a FROM t);
SELECT @c2 - @c1;
@c2 - @c1
0
DROP TABLE t;
#
# Bug#22133710 GCOLS: READ UNCOMMITTED: ASSERT !TABLE || (!TABLE->WRITE_SET || BITMAP_IS_SET(TA
#
CREATE TABLE t (
a INT,
b INT GENERATED ALWAYS AS (1) VIRTUAL,
c INT GENERATED ALWAYS AS (1) VIRTUAL,
d INT GENERATED ALWAYS AS (1) VIRTUAL,
KEY (b,d)
) ENGINE=INNODB;
INSERT INTO t VALUES();
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED ;
SELECT 1 FROM t WHERE c GROUP BY b;
1
1
COMMIT;
DROP TABLE t;
#
# Bug #25793677	INNODB: FAILING ASSERTION: CLUST_TEMPL_FOR_SEC || LEN ....
#
CREATE TABLE v (
a INT,
c INT,
b CHAR(2) GENERATED ALWAYS AS (a IN (1)) VIRTUAL,
KEY(c,b(1))) charset utf8mb4;
INSERT INTO v (a,c) VALUES (1,1);
SELECT (SELECT MAX(c) FROM v);
(SELECT MAX(c) FROM v)
1
DROP TABLE v;
#
# Bug #28652826	THE CONTINUATION OF BUG 27968952 .. CRASH & CORRUPTION
# WITH GCOLS
#
CREATE TABLE t(
a INT NOT NULL,
b INT NOT NULL,
c INT NOT NULL,
g MEDIUMTEXT GENERATED ALWAYS AS((a <> b)) VIRTUAL,
UNIQUE KEY i0000 (a),
UNIQUE KEY i0001 (g(78))
) ENGINE=INNODB;
REPLACE INTO t(a, b, c) VALUES (1,8,9);
REPLACE INTO t(a, b, c) VALUES (0,0,10);
REPLACE INTO t(a, b, c) VALUES (4,4,11);
REPLACE INTO t(a, b, c) VALUES (0,7,12);
REPLACE INTO t(a, b, c) VALUES (0,0,13);
SELECT * FROM t;
a	b	c	g
0	0	13	0
DROP TABLE t;

Man Man