mirror of
https://github.com/MariaDB/server.git
synced 2026-05-16 03:47:17 +02:00
MDEV-17363 - Compressed columns cannot be restored from dump
In collaboration with Sergey Vojtovich <svoj@mariadb.org>
The COMPRESSED clause is now a part of the data type and goes immediately
after the data type and length, but before the CHARACTER SET clause,
and before column attributes such as DEFAULT, COLLATE, ON UPDATE,
SYSTEM VERSIONING, engine specific column attributes.
In the old reduction, the COMPRESSED clause was a column attribute.
New syntax:
<varchar or text data type> <length> <compression> <character set> <column attributes>
<varbinary or blob data type> <length> <compression> <column attributes>
New syntax examples:
VARCHAR(1000) COMPRESSED CHARACTER SET latin1 DEFAULT ''
BLOB COMPRESSED DEFAULT ''
Deprecate syntax examples:
VARCHAR(1000) CHARACTER SET latin1 COMPRESSED DEFAULT ''
TEXT CHARACTER SET latin1 DEFAULT '' COMPRESSED
VARBINARY(1000) DEFAULT '' COMPRESSED
As a side effect:
- COMPRESSED is not valid as an SP label name in SQL/PSM routines any more
(but it's still valid as an SP label name in sql_mode=ORACLE)
- COMPRESSED is now allowed in combination with GENERATED ALWAYS AS:
TEXT COMPRESSED GENERATED ALWAYS AS REPEAT('a',1000)
This commit is contained in:
parent
3784ed7a62
commit
5352e9687a
20 changed files with 3324 additions and 104 deletions
File diff suppressed because it is too large
Load diff
26
mysql-test/suite/compat/oracle/r/keywords.result
Normal file
26
mysql-test/suite/compat/oracle/r/keywords.result
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
SET sql_mode=ORACLE;
|
||||
#
|
||||
# MDEV-17363 Compressed columns cannot be restored from dump
|
||||
# In sql_mode=ORACLE, COMPRESSED is still valid both as an SP label
|
||||
# and an SP variable name.
|
||||
#
|
||||
BEGIN
|
||||
IF TRUE THEN
|
||||
GOTO compressed;
|
||||
END IF;
|
||||
SELECT 'This should not be reached' AS warn;
|
||||
<<compressed>>
|
||||
BEGIN
|
||||
SELECT 1 AS a;
|
||||
END;
|
||||
END
|
||||
$$
|
||||
a
|
||||
1
|
||||
DECLARE compressed INT DEFAULT 1;
|
||||
BEGIN
|
||||
SELECT compressed;
|
||||
END
|
||||
$$
|
||||
compressed
|
||||
1
|
||||
38
mysql-test/suite/compat/oracle/r/mysqldump_restore.result
Normal file
38
mysql-test/suite/compat/oracle/r/mysqldump_restore.result
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
SET sql_mode=ORACLE;
|
||||
#
|
||||
# Start of 10.3 tests
|
||||
#
|
||||
#
|
||||
# MDEV-17363 Compressed columns cannot be restored from dump
|
||||
#
|
||||
CREATE TABLE t1 (a VARCHAR(1000) COMPRESSED CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL);
|
||||
INSERT INTO `t1` VALUES (REPEAT('a', 256));
|
||||
# Begin testing mysqldump output + restore
|
||||
# Create 'original table name - <table>_orig
|
||||
SET @orig_table_name = CONCAT('test.t1', '_orig');
|
||||
# Rename original table
|
||||
ALTER TABLE test.t1 RENAME to test.t1_orig;
|
||||
# Recreate table from mysqldump output
|
||||
# Compare original and recreated tables
|
||||
# Recreated table: test.t1
|
||||
# Original table: test.t1_orig
|
||||
include/diff_tables.inc [test.t1, test.t1_orig]
|
||||
# Cleanup
|
||||
DROP TABLE test.t1, test.t1_orig;
|
||||
CREATE TABLE t1 (a LONGTEXT COMPRESSED CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL);
|
||||
INSERT INTO `t1` VALUES (REPEAT('a', 256));
|
||||
# Begin testing mysqldump output + restore
|
||||
# Create 'original table name - <table>_orig
|
||||
SET @orig_table_name = CONCAT('test.t1', '_orig');
|
||||
# Rename original table
|
||||
ALTER TABLE test.t1 RENAME to test.t1_orig;
|
||||
# Recreate table from mysqldump output
|
||||
# Compare original and recreated tables
|
||||
# Recreated table: test.t1
|
||||
# Original table: test.t1_orig
|
||||
include/diff_tables.inc [test.t1, test.t1_orig]
|
||||
# Cleanup
|
||||
DROP TABLE test.t1, test.t1_orig;
|
||||
#
|
||||
# End of 10.3 tests
|
||||
#
|
||||
|
|
@ -9,3 +9,76 @@ INSERT INTO t1 VALUES (REPEAT('a',10000));
|
|||
SELECT DATA_LENGTH<100 AS c FROM INFORMATION_SCHEMA.TABLES
|
||||
WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test';
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-17363 - Compressed columns cannot be restored from dump
|
||||
--echo #
|
||||
|
||||
--error ER_WRONG_FIELD_SPEC
|
||||
CREATE TABLE t1(a INT NOT NULL COMPRESSED);
|
||||
SHOW WARNINGS;
|
||||
|
||||
CREATE TABLE t1(
|
||||
a JSON COMPRESSED,
|
||||
b VARCHAR(1000) COMPRESSED BINARY,
|
||||
c NVARCHAR(1000) COMPRESSED BINARY,
|
||||
d TINYTEXT COMPRESSED BINARY
|
||||
);
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # VARCHAR and TEXT variants
|
||||
--echo #
|
||||
|
||||
--let type=VARCHAR(10)
|
||||
--source include/column_compression_syntax_varchar.inc
|
||||
|
||||
--let type=VARCHAR2(10)
|
||||
--source include/column_compression_syntax_varchar.inc
|
||||
|
||||
--let type=TINYTEXT
|
||||
--source include/column_compression_syntax_varchar.inc
|
||||
|
||||
--let type=TEXT
|
||||
--source include/column_compression_syntax_varchar.inc
|
||||
|
||||
--let type=MEDIUMTEXT
|
||||
--source include/column_compression_syntax_varchar.inc
|
||||
|
||||
--let type=LONGTEXT
|
||||
--source include/column_compression_syntax_varchar.inc
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # VARBINARY and BLOB variables
|
||||
--echo #
|
||||
|
||||
--let type=VARCHAR(10)
|
||||
--source include/column_compression_syntax_varbinary.inc
|
||||
|
||||
--let type=TINYBLOB
|
||||
--source include/column_compression_syntax_varbinary.inc
|
||||
|
||||
--let type=BLOB
|
||||
--source include/column_compression_syntax_varbinary.inc
|
||||
|
||||
--let type=MEDIUMBLOB
|
||||
--source include/column_compression_syntax_varbinary.inc
|
||||
|
||||
--let type=LONGBLOB
|
||||
--source include/column_compression_syntax_varbinary.inc
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # NVARCHAR
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a NVARCHAR(10) COMPRESSED);
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
--error ER_PARSE_ERROR
|
||||
CREATE TABLE t1 (a NVARCHAR(10) COMPRESSED BINARY COMPRESSED);
|
||||
--error ER_PARSE_ERROR
|
||||
CREATE TABLE t1 (a NVARCHAR(10) COMPRESSED DEFAULT '' COMPRESSED);
|
||||
|
|
|
|||
29
mysql-test/suite/compat/oracle/t/keywords.test
Normal file
29
mysql-test/suite/compat/oracle/t/keywords.test
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
SET sql_mode=ORACLE;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-17363 Compressed columns cannot be restored from dump
|
||||
--echo # In sql_mode=ORACLE, COMPRESSED is still valid both as an SP label
|
||||
--echo # and an SP variable name.
|
||||
--echo #
|
||||
|
||||
DELIMITER $$;
|
||||
BEGIN
|
||||
IF TRUE THEN
|
||||
GOTO compressed;
|
||||
END IF;
|
||||
SELECT 'This should not be reached' AS warn;
|
||||
<<compressed>>
|
||||
BEGIN
|
||||
SELECT 1 AS a;
|
||||
END;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
DELIMITER $$;
|
||||
DECLARE compressed INT DEFAULT 1;
|
||||
BEGIN
|
||||
SELECT compressed;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
30
mysql-test/suite/compat/oracle/t/mysqldump_restore.test
Normal file
30
mysql-test/suite/compat/oracle/t/mysqldump_restore.test
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# See comments in mysql-test/main/mysqldump_restore.test
|
||||
--source include/not_embedded.inc
|
||||
|
||||
SET sql_mode=ORACLE;
|
||||
|
||||
let $mysqldumpfile = $MYSQLTEST_VARDIR/tmp/mysqldumpfile.sql;
|
||||
|
||||
--echo #
|
||||
--echo # Start of 10.3 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-17363 Compressed columns cannot be restored from dump
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a VARCHAR(1000) COMPRESSED CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL);
|
||||
INSERT INTO `t1` VALUES (REPEAT('a', 256));
|
||||
--exec $MYSQL_DUMP --skip-extended-insert test --skip-comments t1 > $mysqldumpfile
|
||||
let $table_name = test.t1;
|
||||
--source include/mysqldump.inc
|
||||
|
||||
CREATE TABLE t1 (a LONGTEXT COMPRESSED CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL);
|
||||
INSERT INTO `t1` VALUES (REPEAT('a', 256));
|
||||
--exec $MYSQL_DUMP --skip-extended-insert test --skip-comments t1 > $mysqldumpfile
|
||||
let $table_name = test.t1;
|
||||
--source include/mysqldump.inc
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.3 tests
|
||||
--echo #
|
||||
Loading…
Add table
Add a link
Reference in a new issue