2017-04-24 15:54:18 +02:00
|
|
|
--source include/have_innodb.inc
|
|
|
|
--source include/have_csv.inc
|
|
|
|
|
|
|
|
let $MYSQLD_DATADIR= `select @@datadir`;
|
|
|
|
|
|
|
|
SET column_compression_zlib_wrap=true;
|
|
|
|
let $typec= BLOB COMPRESSED;
|
|
|
|
let $typeu= BLOB;
|
|
|
|
--source column_compression.inc
|
|
|
|
|
|
|
|
let $typec= TEXT COMPRESSED;
|
|
|
|
let $typeu= TEXT;
|
|
|
|
--source column_compression.inc
|
|
|
|
|
|
|
|
let $typec= VARBINARY(10000) COMPRESSED;
|
|
|
|
let $typeu= VARBINARY(10000);
|
|
|
|
--source column_compression.inc
|
|
|
|
|
|
|
|
let $typec= VARCHAR(10000) COMPRESSED;
|
|
|
|
let $typeu= VARCHAR(10000);
|
|
|
|
--source column_compression.inc
|
|
|
|
|
|
|
|
let $typec= TEXT CHARSET ucs2 COMPRESSED;
|
|
|
|
let $typeu= TEXT;
|
|
|
|
--source column_compression.inc
|
|
|
|
|
|
|
|
SET column_compression_zlib_wrap=DEFAULT;
|
|
|
|
let $typec= BLOB COMPRESSED;
|
|
|
|
let $typeu= BLOB;
|
|
|
|
--source column_compression.inc
|
|
|
|
|
|
|
|
--error ER_WRONG_FIELD_SPEC
|
|
|
|
CREATE TABLE t1(a CHAR(100) COMPRESSED);
|
|
|
|
--error ER_WRONG_FIELD_SPEC
|
|
|
|
CREATE TABLE t1(a INT COMPRESSED);
|
|
|
|
--error ER_UNKNOWN_COMPRESSION_METHOD
|
|
|
|
CREATE TABLE t1(a BLOB COMPRESSED=unknown);
|
|
|
|
CREATE TABLE t1(a BLOB COMPRESSED COMPRESSED);
|
|
|
|
DROP TABLE t1;
|
|
|
|
CREATE TABLE t1(a INT);
|
|
|
|
--error ER_WRONG_FIELD_SPEC
|
|
|
|
ALTER TABLE t1 MODIFY a INT COMPRESSED;
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
--echo # Test CSV
|
|
|
|
CREATE TABLE t1(a BLOB NOT NULL COMPRESSED) ENGINE=CSV;
|
|
|
|
INSERT INTO t1 VALUES(REPEAT('a', 110));
|
|
|
|
SELECT LENGTH(a) FROM t1;
|
|
|
|
ALTER TABLE t1 ENGINE=MyISAM;
|
|
|
|
SELECT LENGTH(a) FROM t1;
|
|
|
|
ALTER TABLE t1 ENGINE=CSV;
|
|
|
|
SELECT LENGTH(a) FROM t1;
|
|
|
|
SHOW CREATE TABLE t1;
|
|
|
|
--cat_file $MYSQLD_DATADIR/test/t1.CSV
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
--echo # Test fields that don't fit data
|
|
|
|
CREATE TABLE t1(a VARCHAR(9) COMPRESSED);
|
|
|
|
--error ER_DATA_TOO_LONG
|
|
|
|
INSERT INTO t1 VALUES(REPEAT('a', 10));
|
|
|
|
INSERT INTO t1 VALUES(REPEAT(' ', 10));
|
|
|
|
SELECT a, LENGTH(a) FROM t1;
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
CREATE TABLE t1(a TINYTEXT COMPRESSED);
|
|
|
|
SET column_compression_threshold=300;
|
2018-05-02 11:45:44 +02:00
|
|
|
INSERT INTO t1 VALUES(REPEAT('a', 254));
|
|
|
|
INSERT INTO t1 VALUES(REPEAT(' ', 254));
|
2017-04-24 15:54:18 +02:00
|
|
|
--error ER_DATA_TOO_LONG
|
|
|
|
INSERT INTO t1 VALUES(REPEAT('a', 255));
|
|
|
|
INSERT INTO t1 VALUES(REPEAT(' ', 255));
|
2018-05-02 11:45:44 +02:00
|
|
|
--error ER_DATA_TOO_LONG
|
|
|
|
INSERT INTO t1 VALUES(REPEAT('a', 256));
|
|
|
|
INSERT INTO t1 VALUES(REPEAT(' ', 256));
|
|
|
|
--error ER_DATA_TOO_LONG
|
|
|
|
INSERT INTO t1 VALUES(REPEAT('a', 257));
|
|
|
|
INSERT INTO t1 VALUES(REPEAT(' ', 257));
|
2017-04-24 15:54:18 +02:00
|
|
|
SET column_compression_threshold=DEFAULT;
|
2018-05-02 11:45:44 +02:00
|
|
|
SELECT LEFT(a, 10), LENGTH(a) FROM t1 ORDER BY 1;
|
2017-04-24 15:54:18 +02:00
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
--echo # Corner case: VARCHAR(255) COMPRESSED must have 2 bytes pack length
|
|
|
|
CREATE TABLE t1(a VARCHAR(255) COMPRESSED);
|
|
|
|
SHOW CREATE TABLE t1;
|
|
|
|
SET column_compression_threshold=300;
|
|
|
|
INSERT INTO t1 VALUES(REPEAT('a', 255));
|
|
|
|
SET column_compression_threshold=DEFAULT;
|
|
|
|
SELECT a, LENGTH(a) FROM t1;
|
|
|
|
DROP TABLE t1;
|
2018-03-21 10:54:15 +01:00
|
|
|
|
2018-05-02 11:45:44 +02:00
|
|
|
CREATE TABLE t1(a VARCHAR(65531) COMPRESSED);
|
|
|
|
SET column_compression_threshold=65537;
|
|
|
|
INSERT INTO t1 VALUES(REPEAT('a', 65530));
|
|
|
|
INSERT INTO t1 VALUES(REPEAT(' ', 65530));
|
|
|
|
INSERT INTO t1 VALUES(REPEAT('a', 65531));
|
|
|
|
INSERT INTO t1 VALUES(REPEAT(' ', 65531));
|
|
|
|
--error ER_DATA_TOO_LONG
|
|
|
|
INSERT INTO t1 VALUES(REPEAT('a', 65532));
|
|
|
|
INSERT INTO t1 VALUES(REPEAT(' ', 65532));
|
|
|
|
--error ER_DATA_TOO_LONG
|
|
|
|
INSERT INTO t1 VALUES(REPEAT('a', 65533));
|
|
|
|
INSERT INTO t1 VALUES(REPEAT(' ', 65533));
|
|
|
|
SET column_compression_threshold=DEFAULT;
|
|
|
|
SELECT LEFT(a, 10), LENGTH(a) FROM t1 ORDER BY 1, 2;
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
2018-03-21 10:54:15 +01:00
|
|
|
|
|
|
|
--echo #
|
|
|
|
--echo # MDEV-14929 - AddressSanitizer: memcpy-param-overlap in
|
|
|
|
--echo # Field_longstr::compress
|
|
|
|
--echo #
|
|
|
|
CREATE TABLE t1(b BLOB COMPRESSED);
|
|
|
|
INSERT INTO t1 VALUES('foo'),('bar');
|
|
|
|
SET SESSION optimizer_switch = 'derived_merge=off';
|
|
|
|
SELECT * FROM ( SELECT * FROM t1 ) AS sq ORDER BY b;
|
|
|
|
SET SESSION optimizer_switch=DEFAULT;
|
|
|
|
DROP TABLE t1;
|
2018-04-03 14:19:37 +02:00
|
|
|
|
|
|
|
|
|
|
|
--echo #
|
|
|
|
--echo # MDEV-15762 - VARCHAR(0) COMPRESSED crashes the server
|
|
|
|
--echo #
|
|
|
|
CREATE TABLE t1(a VARCHAR(0) COMPRESSED);
|
|
|
|
--error ER_DATA_TOO_LONG
|
|
|
|
INSERT INTO t1 VALUES('a');
|
|
|
|
INSERT INTO t1 VALUES(' ');
|
|
|
|
SELECT LENGTH(a) FROM t1;
|
|
|
|
DROP TABLE t1;
|
2018-04-03 16:34:46 +02:00
|
|
|
|
|
|
|
|
|
|
|
--echo #
|
|
|
|
--echo # MDEV-15763 - VARCHAR(1) COMPRESSED crashes the server
|
|
|
|
--echo #
|
|
|
|
CREATE TABLE t1(a VARCHAR(1) COMPRESSED);
|
|
|
|
SET column_compression_threshold=0;
|
|
|
|
INSERT INTO t1 VALUES('a');
|
|
|
|
SET column_compression_threshold=DEFAULT;
|
|
|
|
DROP TABLE t1;
|
2018-04-25 12:42:38 +02:00
|
|
|
|
2018-05-02 11:45:44 +02:00
|
|
|
|
2018-04-25 12:42:38 +02:00
|
|
|
--echo #
|
|
|
|
--echo # MDEV-15938 - TINYTEXT CHARACTER SET utf8 COMPRESSED truncates data
|
|
|
|
--echo #
|
|
|
|
CREATE TABLE t1(a TINYTEXT COMPRESSED, b TINYTEXT) CHARACTER SET utf8;
|
|
|
|
INSERT INTO t1 VALUES (REPEAT(_latin1'a', 254), REPEAT(_latin1'a', 254));
|
|
|
|
SELECT CHAR_LENGTH(a), CHAR_LENGTH(b), LEFT(a, 10), LEFT(b, 10) FROM t1;
|
|
|
|
DROP TABLE t1;
|
2018-05-10 17:30:43 +02:00
|
|
|
|
|
|
|
|
|
|
|
--echo #
|
|
|
|
--echo # MDEV-16134 Wrong I_S.COLUMNS.CHARACTER_XXX_LENGTH value for compressed columns
|
|
|
|
--echo #
|
|
|
|
|
|
|
|
CREATE TABLE t1
|
|
|
|
(
|
|
|
|
a VARCHAR(10) CHARACTER SET latin1 COMPRESSED,
|
|
|
|
b VARCHAR(10) CHARACTER SET utf8 COMPRESSED
|
|
|
|
);
|
|
|
|
SELECT COLUMN_NAME, CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH
|
|
|
|
FROM INFORMATION_SCHEMA.COLUMNS
|
|
|
|
WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1' AND COLUMN_NAME IN ('a','b')
|
|
|
|
ORDER BY COLUMN_NAME;
|
|
|
|
DROP TABLE t1;
|
2018-05-02 11:45:44 +02:00
|
|
|
|
|
|
|
|
|
|
|
--echo #
|
|
|
|
--echo # MDEV-15592 - Column COMPRESSED should select a 'high order' datatype
|
|
|
|
--echo #
|
|
|
|
CREATE TABLE t1(a TINYTEXT COMPRESSED);
|
|
|
|
INSERT INTO t1 VALUES(REPEAT('a', 255));
|
|
|
|
SELECT LEFT(a, 10), LENGTH(a) FROM t1;
|
|
|
|
DROP TABLE t1;
|
2018-07-24 11:19:31 +02:00
|
|
|
|
|
|
|
|
|
|
|
--echo #
|
|
|
|
--echo # MDEV-16729 VARCHAR COMPRESSED is created with a wrong length for multi-byte character sets
|
|
|
|
--echo #
|
|
|
|
|
|
|
|
CREATE OR REPLACE TABLE t1 (a VARCHAR(1000) CHARACTER SET utf8 COMPRESSED);
|
|
|
|
SHOW CREATE TABLE t1;
|
|
|
|
SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
|
|
|
|
WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
|
|
|
|
DROP TABLE t1;
|