diff --git a/mysql-test/include/column_compression_syntax_varbinary.inc b/mysql-test/include/column_compression_syntax_varbinary.inc new file mode 100644 index 00000000000..b609969fc14 --- /dev/null +++ b/mysql-test/include/column_compression_syntax_varbinary.inc @@ -0,0 +1,61 @@ +--echo # +--echo # The following statements run without warnings. +--echo # + +--eval CREATE TABLE t1 (a $type COMPRESSED) +SHOW CREATE TABLE t1; +DROP TABLE t1; + + +--echo # +--echo # The following statements run without warnings. +--echo # They have extra column attributes (or GENERATED) after COMPRESSED. +--echo # + +--eval CREATE TABLE t1 (a $type COMPRESSED DEFAULT '') +SHOW CREATE TABLE t1; +DROP TABLE t1; +--eval CREATE TABLE t1 (a $type COMPRESSED NULL) +SHOW CREATE TABLE t1; +DROP TABLE t1; + +--eval CREATE TABLE t1 (a $type COMPRESSED GENERATED ALWAYS AS (REPEAT('a',10))) +SHOW CREATE TABLE t1; +DROP TABLE t1; + + +--echo # +--echo # The following statements return deprecated syntax warnings +--echo # + +--eval CREATE TABLE t1 (a $type DEFAULT '' COMPRESSED) +SHOW CREATE TABLE t1; +DROP TABLE t1; +--eval CREATE TABLE t1 (a $type NULL COMPRESSED) +SHOW CREATE TABLE t1; +DROP TABLE t1; + + +--echo # +--echo # The following statements fail by the grammar, +--echo # because COMPRESSED immediately follows 'field_type'. +--echo # + +--error ER_PARSE_ERROR +--eval CREATE TABLE t1 (a $type COMPRESSED COMPRESSED) + +--echo # +--echo # The following statements are not prohibited by the *.yy grammar, +--echo # because the sequence `field_type attribute COMPRESSED` is allowed +--echo # (notice there is at least one attribute after `field_type`). +--echo # The first COMPRESSED is parsed inside `field_type`. +--echo # The second COMPRESSED passes through the parser but then is caught +--echo # inside Column_definition::set_compressed_deprecated_with_type_check() +--echo # and a syntax error is raised. +--echo # + +--error ER_PARSE_ERROR +--eval CREATE TABLE t1 (a $type COMPRESSED DEFAULT '' COMPRESSED) +--error ER_PARSE_ERROR +--eval CREATE TABLE t1 (a $type COMPRESSED NULL COMPRESSED) +--error ER_PARSE_ERROR diff --git a/mysql-test/include/column_compression_syntax_varchar.inc b/mysql-test/include/column_compression_syntax_varchar.inc new file mode 100644 index 00000000000..6b96440c511 --- /dev/null +++ b/mysql-test/include/column_compression_syntax_varchar.inc @@ -0,0 +1,99 @@ +--echo # +--echo # The following statements run without warnings. +--echo # The `compressed opt_binary` grammar sequence is covered. +--echo # + +--eval CREATE TABLE t1 (a $type COMPRESSED) +SHOW CREATE TABLE t1; +DROP TABLE t1; +--eval CREATE TABLE t1 (a $type COMPRESSED BINARY) +SHOW CREATE TABLE t1; +DROP TABLE t1; +--eval CREATE TABLE t1 (a $type COMPRESSED BINARY ASCII) +SHOW CREATE TABLE t1; +DROP TABLE t1; +--eval CREATE TABLE t1 (a $type COMPRESSED BYTE) +SHOW CREATE TABLE t1; +DROP TABLE t1; +--eval CREATE TABLE t1 (a $type COMPRESSED ASCII) +SHOW CREATE TABLE t1; +DROP TABLE t1; +--eval CREATE TABLE t1 (a $type COMPRESSED UNICODE) +SHOW CREATE TABLE t1; +DROP TABLE t1; +--eval CREATE TABLE t1 (a $type COMPRESSED CHARACTER SET utf8) +SHOW CREATE TABLE t1; +DROP TABLE t1; + + +--echo # +--echo # The following statements run without warnings. +--echo # They have extra column attributes (or GENERATED) after COMPRESSED. +--echo # + +--eval CREATE TABLE t1 (a $type COMPRESSED BYTE DEFAULT '') +SHOW CREATE TABLE t1; +DROP TABLE t1; +--eval CREATE TABLE t1 (a $type COMPRESSED BINARY DEFAULT '') +SHOW CREATE TABLE t1; +DROP TABLE t1; +--eval CREATE TABLE t1 (a $type COMPRESSED ASCII DEFAULT '') +SHOW CREATE TABLE t1; +DROP TABLE t1; +--eval CREATE TABLE t1 (a $type COMPRESSED CHARACTER SET utf8 DEFAULT '') +SHOW CREATE TABLE t1; +DROP TABLE t1; + +--eval CREATE TABLE t1 (a $type COMPRESSED CHARACTER SET utf8 GENERATED ALWAYS AS (REPEAT('a',100))) +SHOW CREATE TABLE t1; +DROP TABLE t1; + + +--echo # +--echo # The following statements return deprecated syntax warnings +--echo # + +--eval CREATE TABLE t1 (a $type BINARY COMPRESSED) +SHOW CREATE TABLE t1; +DROP TABLE t1; +--eval CREATE TABLE t1 (a $type ASCII COMPRESSED) +SHOW CREATE TABLE t1; +DROP TABLE t1; +--eval CREATE TABLE t1 (a $type BYTE COMPRESSED) +SHOW CREATE TABLE t1; +DROP TABLE t1; + + +--echo # +--echo # The following statements fail by the grammar, +--echo # because COMPRESSED immediately follows 'field_type'. +--echo # + +--error ER_PARSE_ERROR +--eval CREATE TABLE t1 (a $type COMPRESSED BYTE COMPRESSED) +--error ER_PARSE_ERROR +--eval CREATE TABLE t1 (a $type COMPRESSED BINARY COMPRESSED) +--error ER_PARSE_ERROR +--eval CREATE TABLE t1 (a $type COMPRESSED ASCII COMPRESSED) +--error ER_PARSE_ERROR +--eval CREATE TABLE t1 (a $type COMPRESSED CHARACTER SET utf8 COMPRESSED) + + +--echo # +--echo # The following statements are not prohibited by the *.yy grammar, +--echo # because the sequence `field_type attribute COMPRESSED` is allowed +--echo # (notice there is at least one attribute after `field_type`). +--echo # The first COMPRESSED is parsed inside `field_type`. +--echo # The second COMPRESSED passes through the parser but then is caught +--echo # inside Column_definition::set_compressed_deprecated_with_type_check() +--echo # and a syntax error is raised. +--echo # + +--error ER_PARSE_ERROR +--eval CREATE TABLE t1 (a $type COMPRESSED BYTE DEFAULT '' COMPRESSED) +--error ER_PARSE_ERROR +--eval CREATE TABLE t1 (a $type COMPRESSED BINARY DEFAULT '' COMPRESSED) +--error ER_PARSE_ERROR +--eval CREATE TABLE t1 (a $type COMPRESSED ASCII DEFAULT '' COMPRESSED) +--error ER_PARSE_ERROR +--eval CREATE TABLE t1 (a $type COMPRESSED CHARACTER SET utf8 DEFAULT '' COMPRESSED) diff --git a/mysql-test/main/column_compression.result b/mysql-test/main/column_compression.result index c783e7fd1e9..121e74ee5eb 100644 --- a/mysql-test/main/column_compression.result +++ b/mysql-test/main/column_compression.result @@ -860,9 +860,9 @@ foo bar DROP TABLE t1; FLUSH STATUS; -CREATE TABLE t1(a TEXT CHARSET ucs2 COMPRESSED, KEY(a(10))); +CREATE TABLE t1(a TEXT COMPRESSED CHARSET ucs2, KEY(a(10))); ERROR HY000: Compressed column 'a' can't be used in key specification -CREATE TABLE t1(a TEXT CHARSET ucs2 COMPRESSED); +CREATE TABLE t1(a TEXT COMPRESSED CHARSET ucs2); ALTER TABLE t1 ADD KEY(a(10)); ERROR HY000: Compressed column 'a' can't be used in key specification SHOW CREATE TABLE t1; @@ -900,7 +900,7 @@ SELECT DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test' AND DATA_LENGTH 1008 # Rebuild back -ALTER TABLE t1 MODIFY COLUMN a TEXT CHARSET ucs2 COMPRESSED; +ALTER TABLE t1 MODIFY COLUMN a TEXT COMPRESSED CHARSET ucs2; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -975,7 +975,7 @@ VARIABLE_NAME VARIABLE_VALUE COLUMN_COMPRESSIONS 2 COLUMN_DECOMPRESSIONS 10 # Make sure online add column works (requires InnoDB) -ALTER TABLE t1 ADD COLUMN b TEXT CHARSET ucs2 COMPRESSED DEFAULT "must be visible"; +ALTER TABLE t1 ADD COLUMN b TEXT COMPRESSED CHARSET ucs2 DEFAULT "must be visible"; SELECT LEFT(a, 10), LENGTH(a), b FROM t1; LEFT(a, 10) LENGTH(a) b aaaaaaaaaa 2000 must be visible @@ -1054,9 +1054,9 @@ DROP TABLE t1; # MDEV-13540 - Server crashes in copy or Assertion `0' failed in virtual # Field* Field_varstring_compressed::new_key_field # -CREATE TABLE t1 (c1 TEXT CHARSET ucs2 COMPRESSED) ENGINE=MyISAM; +CREATE TABLE t1 (c1 TEXT COMPRESSED CHARSET ucs2) ENGINE=MyISAM; INSERT IGNORE INTO t1 VALUES ('foo'),('bar'); -CREATE TABLE t2 (c2 TEXT CHARSET ucs2 COMPRESSED) ENGINE=MyISAM; +CREATE TABLE t2 (c2 TEXT COMPRESSED CHARSET ucs2) ENGINE=MyISAM; INSERT IGNORE INTO t2 VALUES ('qux'),('abc'); SELECT * FROM t1 WHERE c1 NOT IN ( SELECT c2 FROM t2 WHERE c2 = c1 ); c1 @@ -1067,7 +1067,7 @@ DROP TABLE t1, t2; # MDEV-13541 - Server crashes in next_breadth_first_tab or Assertion `0' # failed in Field_varstring_compressed::new_key_field # -CREATE TABLE t1 (c TEXT CHARSET ucs2 COMPRESSED) ENGINE=InnoDB; +CREATE TABLE t1 (c TEXT COMPRESSED CHARSET ucs2) ENGINE=InnoDB; INSERT INTO t1 VALUES ('foo'),('bar'); SELECT DISTINCT c FROM t1; c @@ -1291,19 +1291,23 @@ foo bar DROP TABLE t1; CREATE TABLE t1(a CHAR(100) COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1(a CHAR(100) NOT NULL COMPRESSED); ERROR 42000: Incorrect column specifier for column 'a' CREATE TABLE t1(a INT COMPRESSED); -ERROR 42000: Incorrect column specifier for column 'a' +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 CREATE TABLE t1(a BLOB COMPRESSED=unknown); ERROR HY000: Unknown compression method: unknown CREATE TABLE t1(a BLOB COMPRESSED COMPRESSED); -DROP TABLE t1; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 CREATE TABLE t1(a INT); ALTER TABLE t1 MODIFY a INT COMPRESSED; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED' at line 1 +ALTER TABLE t1 MODIFY a INT NOT NULL COMPRESSED; ERROR 42000: Incorrect column specifier for column 'a' DROP TABLE t1; # Test CSV -CREATE TABLE t1(a BLOB NOT NULL COMPRESSED) ENGINE=CSV; +CREATE TABLE t1(a BLOB COMPRESSED NOT NULL) ENGINE=CSV; INSERT INTO t1 VALUES(REPEAT('a', 110)); SELECT LENGTH(a) FROM t1; LENGTH(a) @@ -1452,8 +1456,8 @@ DROP TABLE t1; # CREATE TABLE t1 ( -a VARCHAR(10) CHARACTER SET latin1 COMPRESSED, -b VARCHAR(10) CHARACTER SET utf8 COMPRESSED +a VARCHAR(10) COMPRESSED CHARACTER SET latin1, +b VARCHAR(10) COMPRESSED CHARACTER SET utf8 ); SELECT COLUMN_NAME, CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH FROM INFORMATION_SCHEMA.COLUMNS @@ -1475,7 +1479,7 @@ DROP TABLE t1; # # MDEV-16729 VARCHAR COMPRESSED is created with a wrong length for multi-byte character sets # -CREATE OR REPLACE TABLE t1 (a VARCHAR(1000) CHARACTER SET utf8 COMPRESSED); +CREATE OR REPLACE TABLE t1 (a VARCHAR(1000) COMPRESSED CHARACTER SET utf8); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -1486,3 +1490,1176 @@ WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'; COLUMN_TYPE varchar(1000) /*!100301 COMPRESSED*/ DROP TABLE t1; +# +# MDEV-17363 - Compressed columns cannot be restored from dump +# +CREATE TABLE t1(a INT NOT NULL COMPRESSED); +ERROR 42000: Incorrect column specifier for column 'a' +SHOW WARNINGS; +Level Code Message +Error 1063 Incorrect column specifier for column 'a' +CREATE TABLE t1( +a JSON COMPRESSED, +b VARCHAR(1000) COMPRESSED BINARY, +c NVARCHAR(1000) COMPRESSED BINARY, +d TINYTEXT COMPRESSED BINARY +); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` longtext /*!100301 COMPRESSED*/ CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, + `b` varchar(1000) /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL, + `c` varchar(1000) /*!100301 COMPRESSED*/ CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, + `d` tinytext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# VARCHAR and TEXT variants +# +# +# The following statements run without warnings. +# The `compressed opt_binary` grammar sequence is covered. +# +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED BINARY); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED BINARY ASCII); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED BYTE); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varbinary(10) /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED ASCII); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED UNICODE); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED CHARACTER SET utf8); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# The following statements run without warnings. +# They have extra column attributes (or GENERATED) after COMPRESSED. +# +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED BYTE DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varbinary(10) /*!100301 COMPRESSED*/ DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED BINARY DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED ASCII DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) /*!100301 COMPRESSED*/ DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED CHARACTER SET utf8 DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET utf8 DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED CHARACTER SET utf8 GENERATED ALWAYS AS (REPEAT('a',100))); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET utf8 GENERATED ALWAYS AS (repeat('a',100)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# The following statements return deprecated syntax warnings +# +CREATE TABLE t1 (a VARCHAR(10) BINARY COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10) ASCII COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10) BYTE COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varbinary(10) /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# The following statements fail by the grammar, +# because COMPRESSED immediately follows 'field_type'. +# +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED BYTE COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED BINARY COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED ASCII COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED CHARACTER SET utf8 COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# The following statements are not prohibited by the *.yy grammar, +# because the sequence `field_type attribute COMPRESSED` is allowed +# (notice there is at least one attribute after `field_type`). +# The first COMPRESSED is parsed inside `field_type`. +# The second COMPRESSED passes through the parser but then is caught +# inside Column_definition::set_compressed_deprecated_with_type_check() +# and a syntax error is raised. +# +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED BYTE DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED BINARY DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED ASCII DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED CHARACTER SET utf8 DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# The following statements run without warnings. +# The `compressed opt_binary` grammar sequence is covered. +# +CREATE TABLE t1 (a TINYTEXT COMPRESSED); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` tinytext /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a TINYTEXT COMPRESSED BINARY); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` tinytext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a TINYTEXT COMPRESSED BINARY ASCII); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` tinytext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a TINYTEXT COMPRESSED BYTE); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` tinyblob /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a TINYTEXT COMPRESSED ASCII); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` tinytext /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a TINYTEXT COMPRESSED UNICODE); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` tinytext /*!100301 COMPRESSED*/ CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a TINYTEXT COMPRESSED CHARACTER SET utf8); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` tinytext /*!100301 COMPRESSED*/ CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# The following statements run without warnings. +# They have extra column attributes (or GENERATED) after COMPRESSED. +# +CREATE TABLE t1 (a TINYTEXT COMPRESSED BYTE DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` tinyblob /*!100301 COMPRESSED*/ DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a TINYTEXT COMPRESSED BINARY DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` tinytext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a TINYTEXT COMPRESSED ASCII DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` tinytext /*!100301 COMPRESSED*/ DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a TINYTEXT COMPRESSED CHARACTER SET utf8 DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` tinytext /*!100301 COMPRESSED*/ CHARACTER SET utf8 DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a TINYTEXT COMPRESSED CHARACTER SET utf8 GENERATED ALWAYS AS (REPEAT('a',100))); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` tinytext /*!100301 COMPRESSED*/ CHARACTER SET utf8 GENERATED ALWAYS AS (repeat('a',100)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# The following statements return deprecated syntax warnings +# +CREATE TABLE t1 (a TINYTEXT BINARY COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` tinytext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a TINYTEXT ASCII COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` tinytext /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a TINYTEXT BYTE COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` tinyblob /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# The following statements fail by the grammar, +# because COMPRESSED immediately follows 'field_type'. +# +CREATE TABLE t1 (a TINYTEXT COMPRESSED BYTE COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a TINYTEXT COMPRESSED BINARY COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a TINYTEXT COMPRESSED ASCII COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a TINYTEXT COMPRESSED CHARACTER SET utf8 COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# The following statements are not prohibited by the *.yy grammar, +# because the sequence `field_type attribute COMPRESSED` is allowed +# (notice there is at least one attribute after `field_type`). +# The first COMPRESSED is parsed inside `field_type`. +# The second COMPRESSED passes through the parser but then is caught +# inside Column_definition::set_compressed_deprecated_with_type_check() +# and a syntax error is raised. +# +CREATE TABLE t1 (a TINYTEXT COMPRESSED BYTE DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a TINYTEXT COMPRESSED BINARY DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a TINYTEXT COMPRESSED ASCII DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a TINYTEXT COMPRESSED CHARACTER SET utf8 DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# The following statements run without warnings. +# The `compressed opt_binary` grammar sequence is covered. +# +CREATE TABLE t1 (a TEXT COMPRESSED); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a TEXT COMPRESSED BINARY); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a TEXT COMPRESSED BINARY ASCII); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a TEXT COMPRESSED BYTE); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` blob /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a TEXT COMPRESSED ASCII); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a TEXT COMPRESSED UNICODE); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text /*!100301 COMPRESSED*/ CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a TEXT COMPRESSED CHARACTER SET utf8); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text /*!100301 COMPRESSED*/ CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# The following statements run without warnings. +# They have extra column attributes (or GENERATED) after COMPRESSED. +# +CREATE TABLE t1 (a TEXT COMPRESSED BYTE DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` blob /*!100301 COMPRESSED*/ DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a TEXT COMPRESSED BINARY DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a TEXT COMPRESSED ASCII DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text /*!100301 COMPRESSED*/ DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a TEXT COMPRESSED CHARACTER SET utf8 DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text /*!100301 COMPRESSED*/ CHARACTER SET utf8 DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a TEXT COMPRESSED CHARACTER SET utf8 GENERATED ALWAYS AS (REPEAT('a',100))); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text /*!100301 COMPRESSED*/ CHARACTER SET utf8 GENERATED ALWAYS AS (repeat('a',100)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# The following statements return deprecated syntax warnings +# +CREATE TABLE t1 (a TEXT BINARY COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a TEXT ASCII COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a TEXT BYTE COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` blob /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# The following statements fail by the grammar, +# because COMPRESSED immediately follows 'field_type'. +# +CREATE TABLE t1 (a TEXT COMPRESSED BYTE COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a TEXT COMPRESSED BINARY COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a TEXT COMPRESSED ASCII COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a TEXT COMPRESSED CHARACTER SET utf8 COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# The following statements are not prohibited by the *.yy grammar, +# because the sequence `field_type attribute COMPRESSED` is allowed +# (notice there is at least one attribute after `field_type`). +# The first COMPRESSED is parsed inside `field_type`. +# The second COMPRESSED passes through the parser but then is caught +# inside Column_definition::set_compressed_deprecated_with_type_check() +# and a syntax error is raised. +# +CREATE TABLE t1 (a TEXT COMPRESSED BYTE DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a TEXT COMPRESSED BINARY DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a TEXT COMPRESSED ASCII DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a TEXT COMPRESSED CHARACTER SET utf8 DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# The following statements run without warnings. +# The `compressed opt_binary` grammar sequence is covered. +# +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` mediumtext /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED BINARY); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` mediumtext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED BINARY ASCII); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` mediumtext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED BYTE); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` mediumblob /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED ASCII); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` mediumtext /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED UNICODE); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` mediumtext /*!100301 COMPRESSED*/ CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED CHARACTER SET utf8); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` mediumtext /*!100301 COMPRESSED*/ CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# The following statements run without warnings. +# They have extra column attributes (or GENERATED) after COMPRESSED. +# +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED BYTE DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` mediumblob /*!100301 COMPRESSED*/ DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED BINARY DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` mediumtext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED ASCII DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` mediumtext /*!100301 COMPRESSED*/ DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED CHARACTER SET utf8 DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` mediumtext /*!100301 COMPRESSED*/ CHARACTER SET utf8 DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED CHARACTER SET utf8 GENERATED ALWAYS AS (REPEAT('a',100))); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` mediumtext /*!100301 COMPRESSED*/ CHARACTER SET utf8 GENERATED ALWAYS AS (repeat('a',100)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# The following statements return deprecated syntax warnings +# +CREATE TABLE t1 (a MEDIUMTEXT BINARY COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` mediumtext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a MEDIUMTEXT ASCII COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` mediumtext /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a MEDIUMTEXT BYTE COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` mediumblob /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# The following statements fail by the grammar, +# because COMPRESSED immediately follows 'field_type'. +# +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED BYTE COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED BINARY COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED ASCII COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED CHARACTER SET utf8 COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# The following statements are not prohibited by the *.yy grammar, +# because the sequence `field_type attribute COMPRESSED` is allowed +# (notice there is at least one attribute after `field_type`). +# The first COMPRESSED is parsed inside `field_type`. +# The second COMPRESSED passes through the parser but then is caught +# inside Column_definition::set_compressed_deprecated_with_type_check() +# and a syntax error is raised. +# +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED BYTE DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED BINARY DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED ASCII DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED CHARACTER SET utf8 DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# The following statements run without warnings. +# The `compressed opt_binary` grammar sequence is covered. +# +CREATE TABLE t1 (a LONGTEXT COMPRESSED); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` longtext /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a LONGTEXT COMPRESSED BINARY); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` longtext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a LONGTEXT COMPRESSED BINARY ASCII); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` longtext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a LONGTEXT COMPRESSED BYTE); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` longblob /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a LONGTEXT COMPRESSED ASCII); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` longtext /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a LONGTEXT COMPRESSED UNICODE); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` longtext /*!100301 COMPRESSED*/ CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a LONGTEXT COMPRESSED CHARACTER SET utf8); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` longtext /*!100301 COMPRESSED*/ CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# The following statements run without warnings. +# They have extra column attributes (or GENERATED) after COMPRESSED. +# +CREATE TABLE t1 (a LONGTEXT COMPRESSED BYTE DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` longblob /*!100301 COMPRESSED*/ DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a LONGTEXT COMPRESSED BINARY DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` longtext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a LONGTEXT COMPRESSED ASCII DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` longtext /*!100301 COMPRESSED*/ DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a LONGTEXT COMPRESSED CHARACTER SET utf8 DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` longtext /*!100301 COMPRESSED*/ CHARACTER SET utf8 DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a LONGTEXT COMPRESSED CHARACTER SET utf8 GENERATED ALWAYS AS (REPEAT('a',100))); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` longtext /*!100301 COMPRESSED*/ CHARACTER SET utf8 GENERATED ALWAYS AS (repeat('a',100)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# The following statements return deprecated syntax warnings +# +CREATE TABLE t1 (a LONGTEXT BINARY COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` longtext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a LONGTEXT ASCII COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` longtext /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a LONGTEXT BYTE COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` longblob /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# The following statements fail by the grammar, +# because COMPRESSED immediately follows 'field_type'. +# +CREATE TABLE t1 (a LONGTEXT COMPRESSED BYTE COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a LONGTEXT COMPRESSED BINARY COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a LONGTEXT COMPRESSED ASCII COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a LONGTEXT COMPRESSED CHARACTER SET utf8 COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# The following statements are not prohibited by the *.yy grammar, +# because the sequence `field_type attribute COMPRESSED` is allowed +# (notice there is at least one attribute after `field_type`). +# The first COMPRESSED is parsed inside `field_type`. +# The second COMPRESSED passes through the parser but then is caught +# inside Column_definition::set_compressed_deprecated_with_type_check() +# and a syntax error is raised. +# +CREATE TABLE t1 (a LONGTEXT COMPRESSED BYTE DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a LONGTEXT COMPRESSED BINARY DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a LONGTEXT COMPRESSED ASCII DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a LONGTEXT COMPRESSED CHARACTER SET utf8 DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# VARBINARY and BLOB variables +# +# +# The following statements run without warnings. +# +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# The following statements run without warnings. +# They have extra column attributes (or GENERATED) after COMPRESSED. +# +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) /*!100301 COMPRESSED*/ DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED NULL); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED GENERATED ALWAYS AS (REPEAT('a',10))); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) /*!100301 COMPRESSED*/ GENERATED ALWAYS AS (repeat('a',10)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# The following statements return deprecated syntax warnings +# +CREATE TABLE t1 (a VARCHAR(10) DEFAULT '' COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) /*!100301 COMPRESSED*/ DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10) NULL COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# The following statements fail by the grammar, +# because COMPRESSED immediately follows 'field_type'. +# +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# The following statements are not prohibited by the *.yy grammar, +# because the sequence `field_type attribute COMPRESSED` is allowed +# (notice there is at least one attribute after `field_type`). +# The first COMPRESSED is parsed inside `field_type`. +# The second COMPRESSED passes through the parser but then is caught +# inside Column_definition::set_compressed_deprecated_with_type_check() +# and a syntax error is raised. +# +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED NULL COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# The following statements run without warnings. +# +CREATE TABLE t1 (a TINYBLOB COMPRESSED); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` tinyblob /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# The following statements run without warnings. +# They have extra column attributes (or GENERATED) after COMPRESSED. +# +CREATE TABLE t1 (a TINYBLOB COMPRESSED DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` tinyblob /*!100301 COMPRESSED*/ DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a TINYBLOB COMPRESSED NULL); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` tinyblob /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a TINYBLOB COMPRESSED GENERATED ALWAYS AS (REPEAT('a',10))); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` tinyblob /*!100301 COMPRESSED*/ GENERATED ALWAYS AS (repeat('a',10)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# The following statements return deprecated syntax warnings +# +CREATE TABLE t1 (a TINYBLOB DEFAULT '' COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` tinyblob /*!100301 COMPRESSED*/ DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a TINYBLOB NULL COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` tinyblob /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# The following statements fail by the grammar, +# because COMPRESSED immediately follows 'field_type'. +# +CREATE TABLE t1 (a TINYBLOB COMPRESSED COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# The following statements are not prohibited by the *.yy grammar, +# because the sequence `field_type attribute COMPRESSED` is allowed +# (notice there is at least one attribute after `field_type`). +# The first COMPRESSED is parsed inside `field_type`. +# The second COMPRESSED passes through the parser but then is caught +# inside Column_definition::set_compressed_deprecated_with_type_check() +# and a syntax error is raised. +# +CREATE TABLE t1 (a TINYBLOB COMPRESSED DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a TINYBLOB COMPRESSED NULL COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# The following statements run without warnings. +# +CREATE TABLE t1 (a BLOB COMPRESSED); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` blob /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# The following statements run without warnings. +# They have extra column attributes (or GENERATED) after COMPRESSED. +# +CREATE TABLE t1 (a BLOB COMPRESSED DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` blob /*!100301 COMPRESSED*/ DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a BLOB COMPRESSED NULL); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` blob /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a BLOB COMPRESSED GENERATED ALWAYS AS (REPEAT('a',10))); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` blob /*!100301 COMPRESSED*/ GENERATED ALWAYS AS (repeat('a',10)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# The following statements return deprecated syntax warnings +# +CREATE TABLE t1 (a BLOB DEFAULT '' COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` blob /*!100301 COMPRESSED*/ DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a BLOB NULL COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` blob /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# The following statements fail by the grammar, +# because COMPRESSED immediately follows 'field_type'. +# +CREATE TABLE t1 (a BLOB COMPRESSED COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# The following statements are not prohibited by the *.yy grammar, +# because the sequence `field_type attribute COMPRESSED` is allowed +# (notice there is at least one attribute after `field_type`). +# The first COMPRESSED is parsed inside `field_type`. +# The second COMPRESSED passes through the parser but then is caught +# inside Column_definition::set_compressed_deprecated_with_type_check() +# and a syntax error is raised. +# +CREATE TABLE t1 (a BLOB COMPRESSED DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a BLOB COMPRESSED NULL COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# The following statements run without warnings. +# +CREATE TABLE t1 (a MEDIUMBLOB COMPRESSED); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` mediumblob /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# The following statements run without warnings. +# They have extra column attributes (or GENERATED) after COMPRESSED. +# +CREATE TABLE t1 (a MEDIUMBLOB COMPRESSED DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` mediumblob /*!100301 COMPRESSED*/ DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a MEDIUMBLOB COMPRESSED NULL); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` mediumblob /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a MEDIUMBLOB COMPRESSED GENERATED ALWAYS AS (REPEAT('a',10))); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` mediumblob /*!100301 COMPRESSED*/ GENERATED ALWAYS AS (repeat('a',10)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# The following statements return deprecated syntax warnings +# +CREATE TABLE t1 (a MEDIUMBLOB DEFAULT '' COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` mediumblob /*!100301 COMPRESSED*/ DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a MEDIUMBLOB NULL COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` mediumblob /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# The following statements fail by the grammar, +# because COMPRESSED immediately follows 'field_type'. +# +CREATE TABLE t1 (a MEDIUMBLOB COMPRESSED COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# The following statements are not prohibited by the *.yy grammar, +# because the sequence `field_type attribute COMPRESSED` is allowed +# (notice there is at least one attribute after `field_type`). +# The first COMPRESSED is parsed inside `field_type`. +# The second COMPRESSED passes through the parser but then is caught +# inside Column_definition::set_compressed_deprecated_with_type_check() +# and a syntax error is raised. +# +CREATE TABLE t1 (a MEDIUMBLOB COMPRESSED DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a MEDIUMBLOB COMPRESSED NULL COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# The following statements run without warnings. +# +CREATE TABLE t1 (a LONGBLOB COMPRESSED); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` longblob /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# The following statements run without warnings. +# They have extra column attributes (or GENERATED) after COMPRESSED. +# +CREATE TABLE t1 (a LONGBLOB COMPRESSED DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` longblob /*!100301 COMPRESSED*/ DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a LONGBLOB COMPRESSED NULL); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` longblob /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a LONGBLOB COMPRESSED GENERATED ALWAYS AS (REPEAT('a',10))); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` longblob /*!100301 COMPRESSED*/ GENERATED ALWAYS AS (repeat('a',10)) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# The following statements return deprecated syntax warnings +# +CREATE TABLE t1 (a LONGBLOB DEFAULT '' COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` longblob /*!100301 COMPRESSED*/ DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a LONGBLOB NULL COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` longblob /*!100301 COMPRESSED*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# The following statements fail by the grammar, +# because COMPRESSED immediately follows 'field_type'. +# +CREATE TABLE t1 (a LONGBLOB COMPRESSED COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# The following statements are not prohibited by the *.yy grammar, +# because the sequence `field_type attribute COMPRESSED` is allowed +# (notice there is at least one attribute after `field_type`). +# The first COMPRESSED is parsed inside `field_type`. +# The second COMPRESSED passes through the parser but then is caught +# inside Column_definition::set_compressed_deprecated_with_type_check() +# and a syntax error is raised. +# +CREATE TABLE t1 (a LONGBLOB COMPRESSED DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a LONGBLOB COMPRESSED NULL COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# NVARCHAR +# +CREATE TABLE t1 (a NVARCHAR(10) COMPRESSED); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a NVARCHAR(10) COMPRESSED BINARY COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a NVARCHAR(10) COMPRESSED DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 diff --git a/mysql-test/main/column_compression.test b/mysql-test/main/column_compression.test index c9d0014ab9e..092125735cf 100644 --- a/mysql-test/main/column_compression.test +++ b/mysql-test/main/column_compression.test @@ -20,7 +20,7 @@ let $typec= VARCHAR(10000) COMPRESSED; let $typeu= VARCHAR(10000); --source column_compression.inc -let $typec= TEXT CHARSET ucs2 COMPRESSED; +let $typec= TEXT COMPRESSED CHARSET ucs2; let $typeu= TEXT; --source column_compression.inc @@ -29,21 +29,25 @@ let $typec= BLOB COMPRESSED; let $typeu= BLOB; --source column_compression.inc ---error ER_WRONG_FIELD_SPEC +--error ER_PARSE_ERROR CREATE TABLE t1(a CHAR(100) COMPRESSED); --error ER_WRONG_FIELD_SPEC +CREATE TABLE t1(a CHAR(100) NOT NULL COMPRESSED); +--error ER_PARSE_ERROR CREATE TABLE t1(a INT COMPRESSED); --error ER_UNKNOWN_COMPRESSION_METHOD CREATE TABLE t1(a BLOB COMPRESSED=unknown); +--error ER_PARSE_ERROR CREATE TABLE t1(a BLOB COMPRESSED COMPRESSED); -DROP TABLE t1; CREATE TABLE t1(a INT); ---error ER_WRONG_FIELD_SPEC +--error ER_PARSE_ERROR ALTER TABLE t1 MODIFY a INT COMPRESSED; +--error ER_WRONG_FIELD_SPEC +ALTER TABLE t1 MODIFY a INT NOT NULL COMPRESSED; DROP TABLE t1; --echo # Test CSV -CREATE TABLE t1(a BLOB NOT NULL COMPRESSED) ENGINE=CSV; +CREATE TABLE t1(a BLOB COMPRESSED NOT NULL) ENGINE=CSV; INSERT INTO t1 VALUES(REPEAT('a', 110)); SELECT LENGTH(a) FROM t1; ALTER TABLE t1 ENGINE=MyISAM; @@ -153,8 +157,8 @@ DROP TABLE t1; CREATE TABLE t1 ( - a VARCHAR(10) CHARACTER SET latin1 COMPRESSED, - b VARCHAR(10) CHARACTER SET utf8 COMPRESSED + a VARCHAR(10) COMPRESSED CHARACTER SET latin1, + b VARCHAR(10) COMPRESSED CHARACTER SET utf8 ); SELECT COLUMN_NAME, CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH FROM INFORMATION_SCHEMA.COLUMNS @@ -176,8 +180,78 @@ DROP TABLE t1; --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); +CREATE OR REPLACE TABLE t1 (a VARCHAR(1000) COMPRESSED CHARACTER SET utf8); SHOW CREATE TABLE t1; SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'; 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=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); diff --git a/mysql-test/main/keywords.result b/mysql-test/main/keywords.result index e2f29f7cfb5..2765c05b3cb 100644 --- a/mysql-test/main/keywords.result +++ b/mysql-test/main/keywords.result @@ -358,3 +358,36 @@ CREATE TABLE raise (raise int); DROP TABLE raise; CREATE TABLE reuse (reuse int); DROP TABLE reuse; +# +# MDEV-17363 Compressed columns cannot be restored from dump +# COMPRESSED is not valid as an SP label any more +# but is still valid as an SP variable name. +# +BEGIN NOT ATOMIC +compressed: +BEGIN +SELECT 1 AS a; +END; +END +$$ +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'compressed: +BEGIN +SELECT 1 AS a; +END; +END' at line 2 +BEGIN NOT ATOMIC +`compressed`: +BEGIN +SELECT 1 AS a; +END; +END +$$ +a +1 +BEGIN NOT ATOMIC +DECLARE compressed INT DEFAULT 1; +SELECT compressed; +END +$$ +compressed +1 diff --git a/mysql-test/main/keywords.test b/mysql-test/main/keywords.test index 4ac8f56afc5..a745aada106 100644 --- a/mysql-test/main/keywords.test +++ b/mysql-test/main/keywords.test @@ -259,3 +259,39 @@ DROP TABLE raise; CREATE TABLE reuse (reuse int); DROP TABLE reuse; + + +--echo # +--echo # MDEV-17363 Compressed columns cannot be restored from dump +--echo # COMPRESSED is not valid as an SP label any more +--echo # but is still valid as an SP variable name. +--echo # + +DELIMITER $$; +--error ER_PARSE_ERROR +BEGIN NOT ATOMIC +compressed: + BEGIN + SELECT 1 AS a; + END; +END +$$ +DELIMITER ;$$ + +DELIMITER $$; +BEGIN NOT ATOMIC +`compressed`: + BEGIN + SELECT 1 AS a; + END; +END +$$ +DELIMITER ;$$ + +DELIMITER $$; +BEGIN NOT ATOMIC + DECLARE compressed INT DEFAULT 1; + SELECT compressed; +END +$$ +DELIMITER ;$$ diff --git a/mysql-test/main/mysqldump_restore.result b/mysql-test/main/mysqldump_restore.result index 9eac8b253de..cc4a5cd5965 100644 --- a/mysql-test/main/mysqldump_restore.result +++ b/mysql-test/main/mysqldump_restore.result @@ -103,7 +103,43 @@ ALTER TABLE test.t1 RENAME to test.t1_orig; include/diff_tables.inc [test.t1, test.t1_orig] # Cleanup DROP TABLE test.t1, test.t1_orig; -# End tests +# +# 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 - _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 -
_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 +# # Cleanup # Reset concurrent_insert to its original value SET @@global.concurrent_insert = @old_concurrent_insert; diff --git a/mysql-test/main/mysqldump_restore.test b/mysql-test/main/mysqldump_restore.test index 835ee3ee9e9..8d40a4f35f2 100644 --- a/mysql-test/main/mysqldump_restore.test +++ b/mysql-test/main/mysqldump_restore.test @@ -101,7 +101,29 @@ INSERT INTO `t1` VALUES (0x602010000280100005E71A); let $table_name = test.t1; --source include/mysqldump.inc ---echo # End tests +--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 # --echo # Cleanup --echo # Reset concurrent_insert to its original value diff --git a/mysql-test/main/sp.result b/mysql-test/main/sp.result index b7022559dc5..2a32be05bb9 100644 --- a/mysql-test/main/sp.result +++ b/mysql-test/main/sp.result @@ -8814,4 +8814,31 @@ Note 1050 Table 't1' already exists drop procedure p4; drop table t1; set @@sql_mode=@save_sql_mode; +# +# MDEV-17363 Compressed columns cannot be restored from dump +# COMPRESSED conflicted between data type and SP label, +# so it's not allowed as an SP label any more. +# +CREATE FUNCTION f1() RETURNS TEXT COMPRESSED +BEGIN +RETURN ''; +END; +$$ +SHOW CREATE FUNCTION f1; +Function sql_mode Create Function character_set_client collation_connection Database Collation +f1 STRICT_ALL_TABLES CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS text COMPRESSED CHARSET latin1 +BEGIN +RETURN ''; +END latin1 latin1_swedish_ci latin1_swedish_ci +DROP FUNCTION f1; +CREATE FUNCTION f1() RETURNS TEXT +COMPRESSED: +BEGIN +RETURN ''; +END; +$$ +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ': +BEGIN +RETURN ''; +END' at line 2 # End of 10.3 tests diff --git a/mysql-test/main/sp.test b/mysql-test/main/sp.test index 743f0f6781e..e3b62cfadc4 100644 --- a/mysql-test/main/sp.test +++ b/mysql-test/main/sp.test @@ -10335,4 +10335,30 @@ drop procedure p4; drop table t1; set @@sql_mode=@save_sql_mode; +--echo # +--echo # MDEV-17363 Compressed columns cannot be restored from dump +--echo # COMPRESSED conflicted between data type and SP label, +--echo # so it's not allowed as an SP label any more. +--echo # + +DELIMITER $$; +CREATE FUNCTION f1() RETURNS TEXT COMPRESSED +BEGIN + RETURN ''; +END; +$$ +DELIMITER ;$$ +SHOW CREATE FUNCTION f1; +DROP FUNCTION f1; + +DELIMITER $$; +--error ER_PARSE_ERROR +CREATE FUNCTION f1() RETURNS TEXT +COMPRESSED: +BEGIN + RETURN ''; +END; +$$ +DELIMITER ;$$ + --echo # End of 10.3 tests diff --git a/mysql-test/suite/compat/oracle/r/column_compression.result b/mysql-test/suite/compat/oracle/r/column_compression.result index eaa4de002a4..1b828ca17b0 100644 --- a/mysql-test/suite/compat/oracle/r/column_compression.result +++ b/mysql-test/suite/compat/oracle/r/column_compression.result @@ -7,3 +7,1327 @@ WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test'; c 1 DROP TABLE t1; +# +# MDEV-17363 - Compressed columns cannot be restored from dump +# +CREATE TABLE t1(a INT NOT NULL COMPRESSED); +ERROR 42000: Incorrect column specifier for column 'a' +SHOW WARNINGS; +Level Code Message +Error 1063 Incorrect column specifier for column 'a' +CREATE TABLE t1( +a JSON COMPRESSED, +b VARCHAR(1000) COMPRESSED BINARY, +c NVARCHAR(1000) COMPRESSED BINARY, +d TINYTEXT COMPRESSED BINARY +); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" longtext /*!100301 COMPRESSED*/ CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, + "b" varchar(1000) /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL, + "c" varchar(1000) /*!100301 COMPRESSED*/ CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, + "d" tinytext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) +DROP TABLE t1; +# +# VARCHAR and TEXT variants +# +# +# The following statements run without warnings. +# The `compressed opt_binary` grammar sequence is covered. +# +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" varchar(10) /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED BINARY); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED BINARY ASCII); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED BYTE); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" varbinary(10) /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED ASCII); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" varchar(10) /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED UNICODE); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET ucs2 DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED CHARACTER SET utf8); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET utf8 DEFAULT NULL +) +DROP TABLE t1; +# +# The following statements run without warnings. +# They have extra column attributes (or GENERATED) after COMPRESSED. +# +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED BYTE DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" varbinary(10) /*!100301 COMPRESSED*/ DEFAULT '' +) +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED BINARY DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT '' +) +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED ASCII DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" varchar(10) /*!100301 COMPRESSED*/ DEFAULT '' +) +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED CHARACTER SET utf8 DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET utf8 DEFAULT '' +) +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED CHARACTER SET utf8 GENERATED ALWAYS AS (REPEAT('a',100))); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET utf8 GENERATED ALWAYS AS (repeat('a',100)) VIRTUAL +) +DROP TABLE t1; +# +# The following statements return deprecated syntax warnings +# +CREATE TABLE t1 (a VARCHAR(10) BINARY COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10) ASCII COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" varchar(10) /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10) BYTE COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" varbinary(10) /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +# +# The following statements fail by the grammar, +# because COMPRESSED immediately follows 'field_type'. +# +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED BYTE COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED BINARY COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED ASCII COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED CHARACTER SET utf8 COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# The following statements are not prohibited by the *.yy grammar, +# because the sequence `field_type attribute COMPRESSED` is allowed +# (notice there is at least one attribute after `field_type`). +# The first COMPRESSED is parsed inside `field_type`. +# The second COMPRESSED passes through the parser but then is caught +# inside Column_definition::set_compressed_deprecated_with_type_check() +# and a syntax error is raised. +# +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED BYTE DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED BINARY DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED ASCII DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED CHARACTER SET utf8 DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# The following statements run without warnings. +# The `compressed opt_binary` grammar sequence is covered. +# +CREATE TABLE t1 (a VARCHAR2(10) COMPRESSED); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" varchar(10) /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR2(10) COMPRESSED BINARY); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR2(10) COMPRESSED BINARY ASCII); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR2(10) COMPRESSED BYTE); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" varbinary(10) /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR2(10) COMPRESSED ASCII); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" varchar(10) /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR2(10) COMPRESSED UNICODE); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET ucs2 DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR2(10) COMPRESSED CHARACTER SET utf8); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET utf8 DEFAULT NULL +) +DROP TABLE t1; +# +# The following statements run without warnings. +# They have extra column attributes (or GENERATED) after COMPRESSED. +# +CREATE TABLE t1 (a VARCHAR2(10) COMPRESSED BYTE DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" varbinary(10) /*!100301 COMPRESSED*/ DEFAULT '' +) +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR2(10) COMPRESSED BINARY DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT '' +) +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR2(10) COMPRESSED ASCII DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" varchar(10) /*!100301 COMPRESSED*/ DEFAULT '' +) +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR2(10) COMPRESSED CHARACTER SET utf8 DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET utf8 DEFAULT '' +) +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR2(10) COMPRESSED CHARACTER SET utf8 GENERATED ALWAYS AS (REPEAT('a',100))); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET utf8 GENERATED ALWAYS AS (repeat('a',100)) VIRTUAL +) +DROP TABLE t1; +# +# The following statements return deprecated syntax warnings +# +CREATE TABLE t1 (a VARCHAR2(10) BINARY COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR2(10) ASCII COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" varchar(10) /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR2(10) BYTE COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" varbinary(10) /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +# +# The following statements fail by the grammar, +# because COMPRESSED immediately follows 'field_type'. +# +CREATE TABLE t1 (a VARCHAR2(10) COMPRESSED BYTE COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a VARCHAR2(10) COMPRESSED BINARY COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a VARCHAR2(10) COMPRESSED ASCII COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a VARCHAR2(10) COMPRESSED CHARACTER SET utf8 COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# The following statements are not prohibited by the *.yy grammar, +# because the sequence `field_type attribute COMPRESSED` is allowed +# (notice there is at least one attribute after `field_type`). +# The first COMPRESSED is parsed inside `field_type`. +# The second COMPRESSED passes through the parser but then is caught +# inside Column_definition::set_compressed_deprecated_with_type_check() +# and a syntax error is raised. +# +CREATE TABLE t1 (a VARCHAR2(10) COMPRESSED BYTE DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a VARCHAR2(10) COMPRESSED BINARY DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a VARCHAR2(10) COMPRESSED ASCII DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a VARCHAR2(10) COMPRESSED CHARACTER SET utf8 DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# The following statements run without warnings. +# The `compressed opt_binary` grammar sequence is covered. +# +CREATE TABLE t1 (a TINYTEXT COMPRESSED); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" tinytext /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a TINYTEXT COMPRESSED BINARY); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" tinytext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a TINYTEXT COMPRESSED BINARY ASCII); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" tinytext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a TINYTEXT COMPRESSED BYTE); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" tinyblob /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a TINYTEXT COMPRESSED ASCII); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" tinytext /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a TINYTEXT COMPRESSED UNICODE); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" tinytext /*!100301 COMPRESSED*/ CHARACTER SET ucs2 DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a TINYTEXT COMPRESSED CHARACTER SET utf8); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" tinytext /*!100301 COMPRESSED*/ CHARACTER SET utf8 DEFAULT NULL +) +DROP TABLE t1; +# +# The following statements run without warnings. +# They have extra column attributes (or GENERATED) after COMPRESSED. +# +CREATE TABLE t1 (a TINYTEXT COMPRESSED BYTE DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" tinyblob /*!100301 COMPRESSED*/ DEFAULT '' +) +DROP TABLE t1; +CREATE TABLE t1 (a TINYTEXT COMPRESSED BINARY DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" tinytext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT '' +) +DROP TABLE t1; +CREATE TABLE t1 (a TINYTEXT COMPRESSED ASCII DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" tinytext /*!100301 COMPRESSED*/ DEFAULT '' +) +DROP TABLE t1; +CREATE TABLE t1 (a TINYTEXT COMPRESSED CHARACTER SET utf8 DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" tinytext /*!100301 COMPRESSED*/ CHARACTER SET utf8 DEFAULT '' +) +DROP TABLE t1; +CREATE TABLE t1 (a TINYTEXT COMPRESSED CHARACTER SET utf8 GENERATED ALWAYS AS (REPEAT('a',100))); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" tinytext /*!100301 COMPRESSED*/ CHARACTER SET utf8 GENERATED ALWAYS AS (repeat('a',100)) VIRTUAL +) +DROP TABLE t1; +# +# The following statements return deprecated syntax warnings +# +CREATE TABLE t1 (a TINYTEXT BINARY COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" tinytext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a TINYTEXT ASCII COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" tinytext /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a TINYTEXT BYTE COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" tinyblob /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +# +# The following statements fail by the grammar, +# because COMPRESSED immediately follows 'field_type'. +# +CREATE TABLE t1 (a TINYTEXT COMPRESSED BYTE COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a TINYTEXT COMPRESSED BINARY COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a TINYTEXT COMPRESSED ASCII COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a TINYTEXT COMPRESSED CHARACTER SET utf8 COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# The following statements are not prohibited by the *.yy grammar, +# because the sequence `field_type attribute COMPRESSED` is allowed +# (notice there is at least one attribute after `field_type`). +# The first COMPRESSED is parsed inside `field_type`. +# The second COMPRESSED passes through the parser but then is caught +# inside Column_definition::set_compressed_deprecated_with_type_check() +# and a syntax error is raised. +# +CREATE TABLE t1 (a TINYTEXT COMPRESSED BYTE DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a TINYTEXT COMPRESSED BINARY DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a TINYTEXT COMPRESSED ASCII DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a TINYTEXT COMPRESSED CHARACTER SET utf8 DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# The following statements run without warnings. +# The `compressed opt_binary` grammar sequence is covered. +# +CREATE TABLE t1 (a TEXT COMPRESSED); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" text /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a TEXT COMPRESSED BINARY); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" text /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a TEXT COMPRESSED BINARY ASCII); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" text /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a TEXT COMPRESSED BYTE); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" blob /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a TEXT COMPRESSED ASCII); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" text /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a TEXT COMPRESSED UNICODE); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" text /*!100301 COMPRESSED*/ CHARACTER SET ucs2 DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a TEXT COMPRESSED CHARACTER SET utf8); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" text /*!100301 COMPRESSED*/ CHARACTER SET utf8 DEFAULT NULL +) +DROP TABLE t1; +# +# The following statements run without warnings. +# They have extra column attributes (or GENERATED) after COMPRESSED. +# +CREATE TABLE t1 (a TEXT COMPRESSED BYTE DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" blob /*!100301 COMPRESSED*/ DEFAULT '' +) +DROP TABLE t1; +CREATE TABLE t1 (a TEXT COMPRESSED BINARY DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" text /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT '' +) +DROP TABLE t1; +CREATE TABLE t1 (a TEXT COMPRESSED ASCII DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" text /*!100301 COMPRESSED*/ DEFAULT '' +) +DROP TABLE t1; +CREATE TABLE t1 (a TEXT COMPRESSED CHARACTER SET utf8 DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" text /*!100301 COMPRESSED*/ CHARACTER SET utf8 DEFAULT '' +) +DROP TABLE t1; +CREATE TABLE t1 (a TEXT COMPRESSED CHARACTER SET utf8 GENERATED ALWAYS AS (REPEAT('a',100))); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" text /*!100301 COMPRESSED*/ CHARACTER SET utf8 GENERATED ALWAYS AS (repeat('a',100)) VIRTUAL +) +DROP TABLE t1; +# +# The following statements return deprecated syntax warnings +# +CREATE TABLE t1 (a TEXT BINARY COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" text /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a TEXT ASCII COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" text /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a TEXT BYTE COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" blob /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +# +# The following statements fail by the grammar, +# because COMPRESSED immediately follows 'field_type'. +# +CREATE TABLE t1 (a TEXT COMPRESSED BYTE COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a TEXT COMPRESSED BINARY COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a TEXT COMPRESSED ASCII COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a TEXT COMPRESSED CHARACTER SET utf8 COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# The following statements are not prohibited by the *.yy grammar, +# because the sequence `field_type attribute COMPRESSED` is allowed +# (notice there is at least one attribute after `field_type`). +# The first COMPRESSED is parsed inside `field_type`. +# The second COMPRESSED passes through the parser but then is caught +# inside Column_definition::set_compressed_deprecated_with_type_check() +# and a syntax error is raised. +# +CREATE TABLE t1 (a TEXT COMPRESSED BYTE DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a TEXT COMPRESSED BINARY DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a TEXT COMPRESSED ASCII DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a TEXT COMPRESSED CHARACTER SET utf8 DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# The following statements run without warnings. +# The `compressed opt_binary` grammar sequence is covered. +# +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" mediumtext /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED BINARY); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" mediumtext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED BINARY ASCII); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" mediumtext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED BYTE); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" mediumblob /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED ASCII); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" mediumtext /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED UNICODE); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" mediumtext /*!100301 COMPRESSED*/ CHARACTER SET ucs2 DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED CHARACTER SET utf8); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" mediumtext /*!100301 COMPRESSED*/ CHARACTER SET utf8 DEFAULT NULL +) +DROP TABLE t1; +# +# The following statements run without warnings. +# They have extra column attributes (or GENERATED) after COMPRESSED. +# +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED BYTE DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" mediumblob /*!100301 COMPRESSED*/ DEFAULT '' +) +DROP TABLE t1; +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED BINARY DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" mediumtext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT '' +) +DROP TABLE t1; +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED ASCII DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" mediumtext /*!100301 COMPRESSED*/ DEFAULT '' +) +DROP TABLE t1; +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED CHARACTER SET utf8 DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" mediumtext /*!100301 COMPRESSED*/ CHARACTER SET utf8 DEFAULT '' +) +DROP TABLE t1; +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED CHARACTER SET utf8 GENERATED ALWAYS AS (REPEAT('a',100))); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" mediumtext /*!100301 COMPRESSED*/ CHARACTER SET utf8 GENERATED ALWAYS AS (repeat('a',100)) VIRTUAL +) +DROP TABLE t1; +# +# The following statements return deprecated syntax warnings +# +CREATE TABLE t1 (a MEDIUMTEXT BINARY COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" mediumtext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a MEDIUMTEXT ASCII COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" mediumtext /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a MEDIUMTEXT BYTE COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" mediumblob /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +# +# The following statements fail by the grammar, +# because COMPRESSED immediately follows 'field_type'. +# +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED BYTE COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED BINARY COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED ASCII COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED CHARACTER SET utf8 COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# The following statements are not prohibited by the *.yy grammar, +# because the sequence `field_type attribute COMPRESSED` is allowed +# (notice there is at least one attribute after `field_type`). +# The first COMPRESSED is parsed inside `field_type`. +# The second COMPRESSED passes through the parser but then is caught +# inside Column_definition::set_compressed_deprecated_with_type_check() +# and a syntax error is raised. +# +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED BYTE DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED BINARY DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED ASCII DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a MEDIUMTEXT COMPRESSED CHARACTER SET utf8 DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# The following statements run without warnings. +# The `compressed opt_binary` grammar sequence is covered. +# +CREATE TABLE t1 (a LONGTEXT COMPRESSED); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" longtext /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a LONGTEXT COMPRESSED BINARY); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" longtext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a LONGTEXT COMPRESSED BINARY ASCII); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" longtext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a LONGTEXT COMPRESSED BYTE); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" longblob /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a LONGTEXT COMPRESSED ASCII); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" longtext /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a LONGTEXT COMPRESSED UNICODE); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" longtext /*!100301 COMPRESSED*/ CHARACTER SET ucs2 DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a LONGTEXT COMPRESSED CHARACTER SET utf8); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" longtext /*!100301 COMPRESSED*/ CHARACTER SET utf8 DEFAULT NULL +) +DROP TABLE t1; +# +# The following statements run without warnings. +# They have extra column attributes (or GENERATED) after COMPRESSED. +# +CREATE TABLE t1 (a LONGTEXT COMPRESSED BYTE DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" longblob /*!100301 COMPRESSED*/ DEFAULT '' +) +DROP TABLE t1; +CREATE TABLE t1 (a LONGTEXT COMPRESSED BINARY DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" longtext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT '' +) +DROP TABLE t1; +CREATE TABLE t1 (a LONGTEXT COMPRESSED ASCII DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" longtext /*!100301 COMPRESSED*/ DEFAULT '' +) +DROP TABLE t1; +CREATE TABLE t1 (a LONGTEXT COMPRESSED CHARACTER SET utf8 DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" longtext /*!100301 COMPRESSED*/ CHARACTER SET utf8 DEFAULT '' +) +DROP TABLE t1; +CREATE TABLE t1 (a LONGTEXT COMPRESSED CHARACTER SET utf8 GENERATED ALWAYS AS (REPEAT('a',100))); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" longtext /*!100301 COMPRESSED*/ CHARACTER SET utf8 GENERATED ALWAYS AS (repeat('a',100)) VIRTUAL +) +DROP TABLE t1; +# +# The following statements return deprecated syntax warnings +# +CREATE TABLE t1 (a LONGTEXT BINARY COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" longtext /*!100301 COMPRESSED*/ CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a LONGTEXT ASCII COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" longtext /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a LONGTEXT BYTE COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" longblob /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +# +# The following statements fail by the grammar, +# because COMPRESSED immediately follows 'field_type'. +# +CREATE TABLE t1 (a LONGTEXT COMPRESSED BYTE COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a LONGTEXT COMPRESSED BINARY COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a LONGTEXT COMPRESSED ASCII COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a LONGTEXT COMPRESSED CHARACTER SET utf8 COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# The following statements are not prohibited by the *.yy grammar, +# because the sequence `field_type attribute COMPRESSED` is allowed +# (notice there is at least one attribute after `field_type`). +# The first COMPRESSED is parsed inside `field_type`. +# The second COMPRESSED passes through the parser but then is caught +# inside Column_definition::set_compressed_deprecated_with_type_check() +# and a syntax error is raised. +# +CREATE TABLE t1 (a LONGTEXT COMPRESSED BYTE DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a LONGTEXT COMPRESSED BINARY DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a LONGTEXT COMPRESSED ASCII DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a LONGTEXT COMPRESSED CHARACTER SET utf8 DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# VARBINARY and BLOB variables +# +# +# The following statements run without warnings. +# +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" varchar(10) /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +# +# The following statements run without warnings. +# They have extra column attributes (or GENERATED) after COMPRESSED. +# +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" varchar(10) /*!100301 COMPRESSED*/ DEFAULT '' +) +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED NULL); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" varchar(10) /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED GENERATED ALWAYS AS (REPEAT('a',10))); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" varchar(10) /*!100301 COMPRESSED*/ GENERATED ALWAYS AS (repeat('a',10)) VIRTUAL +) +DROP TABLE t1; +# +# The following statements return deprecated syntax warnings +# +CREATE TABLE t1 (a VARCHAR(10) DEFAULT '' COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" varchar(10) /*!100301 COMPRESSED*/ DEFAULT '' +) +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10) NULL COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" varchar(10) /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +# +# The following statements fail by the grammar, +# because COMPRESSED immediately follows 'field_type'. +# +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# The following statements are not prohibited by the *.yy grammar, +# because the sequence `field_type attribute COMPRESSED` is allowed +# (notice there is at least one attribute after `field_type`). +# The first COMPRESSED is parsed inside `field_type`. +# The second COMPRESSED passes through the parser but then is caught +# inside Column_definition::set_compressed_deprecated_with_type_check() +# and a syntax error is raised. +# +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a VARCHAR(10) COMPRESSED NULL COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# The following statements run without warnings. +# +CREATE TABLE t1 (a TINYBLOB COMPRESSED); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" tinyblob /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +# +# The following statements run without warnings. +# They have extra column attributes (or GENERATED) after COMPRESSED. +# +CREATE TABLE t1 (a TINYBLOB COMPRESSED DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" tinyblob /*!100301 COMPRESSED*/ DEFAULT '' +) +DROP TABLE t1; +CREATE TABLE t1 (a TINYBLOB COMPRESSED NULL); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" tinyblob /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a TINYBLOB COMPRESSED GENERATED ALWAYS AS (REPEAT('a',10))); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" tinyblob /*!100301 COMPRESSED*/ GENERATED ALWAYS AS (repeat('a',10)) VIRTUAL +) +DROP TABLE t1; +# +# The following statements return deprecated syntax warnings +# +CREATE TABLE t1 (a TINYBLOB DEFAULT '' COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" tinyblob /*!100301 COMPRESSED*/ DEFAULT '' +) +DROP TABLE t1; +CREATE TABLE t1 (a TINYBLOB NULL COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" tinyblob /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +# +# The following statements fail by the grammar, +# because COMPRESSED immediately follows 'field_type'. +# +CREATE TABLE t1 (a TINYBLOB COMPRESSED COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# The following statements are not prohibited by the *.yy grammar, +# because the sequence `field_type attribute COMPRESSED` is allowed +# (notice there is at least one attribute after `field_type`). +# The first COMPRESSED is parsed inside `field_type`. +# The second COMPRESSED passes through the parser but then is caught +# inside Column_definition::set_compressed_deprecated_with_type_check() +# and a syntax error is raised. +# +CREATE TABLE t1 (a TINYBLOB COMPRESSED DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a TINYBLOB COMPRESSED NULL COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# The following statements run without warnings. +# +CREATE TABLE t1 (a BLOB COMPRESSED); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" longblob /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +# +# The following statements run without warnings. +# They have extra column attributes (or GENERATED) after COMPRESSED. +# +CREATE TABLE t1 (a BLOB COMPRESSED DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" longblob /*!100301 COMPRESSED*/ DEFAULT '' +) +DROP TABLE t1; +CREATE TABLE t1 (a BLOB COMPRESSED NULL); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" longblob /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a BLOB COMPRESSED GENERATED ALWAYS AS (REPEAT('a',10))); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" longblob /*!100301 COMPRESSED*/ GENERATED ALWAYS AS (repeat('a',10)) VIRTUAL +) +DROP TABLE t1; +# +# The following statements return deprecated syntax warnings +# +CREATE TABLE t1 (a BLOB DEFAULT '' COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" longblob /*!100301 COMPRESSED*/ DEFAULT '' +) +DROP TABLE t1; +CREATE TABLE t1 (a BLOB NULL COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" longblob /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +# +# The following statements fail by the grammar, +# because COMPRESSED immediately follows 'field_type'. +# +CREATE TABLE t1 (a BLOB COMPRESSED COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# The following statements are not prohibited by the *.yy grammar, +# because the sequence `field_type attribute COMPRESSED` is allowed +# (notice there is at least one attribute after `field_type`). +# The first COMPRESSED is parsed inside `field_type`. +# The second COMPRESSED passes through the parser but then is caught +# inside Column_definition::set_compressed_deprecated_with_type_check() +# and a syntax error is raised. +# +CREATE TABLE t1 (a BLOB COMPRESSED DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a BLOB COMPRESSED NULL COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# The following statements run without warnings. +# +CREATE TABLE t1 (a MEDIUMBLOB COMPRESSED); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" mediumblob /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +# +# The following statements run without warnings. +# They have extra column attributes (or GENERATED) after COMPRESSED. +# +CREATE TABLE t1 (a MEDIUMBLOB COMPRESSED DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" mediumblob /*!100301 COMPRESSED*/ DEFAULT '' +) +DROP TABLE t1; +CREATE TABLE t1 (a MEDIUMBLOB COMPRESSED NULL); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" mediumblob /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a MEDIUMBLOB COMPRESSED GENERATED ALWAYS AS (REPEAT('a',10))); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" mediumblob /*!100301 COMPRESSED*/ GENERATED ALWAYS AS (repeat('a',10)) VIRTUAL +) +DROP TABLE t1; +# +# The following statements return deprecated syntax warnings +# +CREATE TABLE t1 (a MEDIUMBLOB DEFAULT '' COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" mediumblob /*!100301 COMPRESSED*/ DEFAULT '' +) +DROP TABLE t1; +CREATE TABLE t1 (a MEDIUMBLOB NULL COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" mediumblob /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +# +# The following statements fail by the grammar, +# because COMPRESSED immediately follows 'field_type'. +# +CREATE TABLE t1 (a MEDIUMBLOB COMPRESSED COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# The following statements are not prohibited by the *.yy grammar, +# because the sequence `field_type attribute COMPRESSED` is allowed +# (notice there is at least one attribute after `field_type`). +# The first COMPRESSED is parsed inside `field_type`. +# The second COMPRESSED passes through the parser but then is caught +# inside Column_definition::set_compressed_deprecated_with_type_check() +# and a syntax error is raised. +# +CREATE TABLE t1 (a MEDIUMBLOB COMPRESSED DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a MEDIUMBLOB COMPRESSED NULL COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# The following statements run without warnings. +# +CREATE TABLE t1 (a LONGBLOB COMPRESSED); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" longblob /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +# +# The following statements run without warnings. +# They have extra column attributes (or GENERATED) after COMPRESSED. +# +CREATE TABLE t1 (a LONGBLOB COMPRESSED DEFAULT ''); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" longblob /*!100301 COMPRESSED*/ DEFAULT '' +) +DROP TABLE t1; +CREATE TABLE t1 (a LONGBLOB COMPRESSED NULL); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" longblob /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a LONGBLOB COMPRESSED GENERATED ALWAYS AS (REPEAT('a',10))); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" longblob /*!100301 COMPRESSED*/ GENERATED ALWAYS AS (repeat('a',10)) VIRTUAL +) +DROP TABLE t1; +# +# The following statements return deprecated syntax warnings +# +CREATE TABLE t1 (a LONGBLOB DEFAULT '' COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" longblob /*!100301 COMPRESSED*/ DEFAULT '' +) +DROP TABLE t1; +CREATE TABLE t1 (a LONGBLOB NULL COMPRESSED); +Warnings: +Warning 1287 ' ... COMPRESSED...' is deprecated and will be removed in a future release. Please use ' COMPRESSED... ...' instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" longblob /*!100301 COMPRESSED*/ DEFAULT NULL +) +DROP TABLE t1; +# +# The following statements fail by the grammar, +# because COMPRESSED immediately follows 'field_type'. +# +CREATE TABLE t1 (a LONGBLOB COMPRESSED COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# The following statements are not prohibited by the *.yy grammar, +# because the sequence `field_type attribute COMPRESSED` is allowed +# (notice there is at least one attribute after `field_type`). +# The first COMPRESSED is parsed inside `field_type`. +# The second COMPRESSED passes through the parser but then is caught +# inside Column_definition::set_compressed_deprecated_with_type_check() +# and a syntax error is raised. +# +CREATE TABLE t1 (a LONGBLOB COMPRESSED DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a LONGBLOB COMPRESSED NULL COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +# +# NVARCHAR +# +CREATE TABLE t1 (a NVARCHAR(10) COMPRESSED); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" varchar(10) /*!100301 COMPRESSED*/ CHARACTER SET utf8 DEFAULT NULL +) +DROP TABLE t1; +CREATE TABLE t1 (a NVARCHAR(10) COMPRESSED BINARY COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 +CREATE TABLE t1 (a NVARCHAR(10) COMPRESSED DEFAULT '' COMPRESSED); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPRESSED)' at line 1 diff --git a/mysql-test/suite/compat/oracle/r/keywords.result b/mysql-test/suite/compat/oracle/r/keywords.result new file mode 100644 index 00000000000..bc9d3d9b6d6 --- /dev/null +++ b/mysql-test/suite/compat/oracle/r/keywords.result @@ -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; +<> +BEGIN +SELECT 1 AS a; +END; +END +$$ +a +1 +DECLARE compressed INT DEFAULT 1; +BEGIN +SELECT compressed; +END +$$ +compressed +1 diff --git a/mysql-test/suite/compat/oracle/r/mysqldump_restore.result b/mysql-test/suite/compat/oracle/r/mysqldump_restore.result new file mode 100644 index 00000000000..f73fa3a3639 --- /dev/null +++ b/mysql-test/suite/compat/oracle/r/mysqldump_restore.result @@ -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 -
_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 -
_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 +# diff --git a/mysql-test/suite/compat/oracle/t/column_compression.test b/mysql-test/suite/compat/oracle/t/column_compression.test index 5544ff6c0b7..6fcdd119890 100644 --- a/mysql-test/suite/compat/oracle/t/column_compression.test +++ b/mysql-test/suite/compat/oracle/t/column_compression.test @@ -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); diff --git a/mysql-test/suite/compat/oracle/t/keywords.test b/mysql-test/suite/compat/oracle/t/keywords.test new file mode 100644 index 00000000000..0768633bf8b --- /dev/null +++ b/mysql-test/suite/compat/oracle/t/keywords.test @@ -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; +<> + BEGIN + SELECT 1 AS a; + END; +END +$$ +DELIMITER ;$$ + +DELIMITER $$; +DECLARE compressed INT DEFAULT 1; +BEGIN + SELECT compressed; +END +$$ +DELIMITER ;$$ diff --git a/mysql-test/suite/compat/oracle/t/mysqldump_restore.test b/mysql-test/suite/compat/oracle/t/mysqldump_restore.test new file mode 100644 index 00000000000..dd54c2b5636 --- /dev/null +++ b/mysql-test/suite/compat/oracle/t/mysqldump_restore.test @@ -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 # diff --git a/sql/field.cc b/sql/field.cc index c6bdb013cdf..842f92e858f 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -11105,20 +11105,48 @@ bool Column_definition::has_default_expression() bool Column_definition::set_compressed(const char *method) { + if (!method || !strcmp(method, zlib_compression_method->name)) + { + unireg_check= Field::TMYSQL_COMPRESSED; + compression_method_ptr= zlib_compression_method; + return false; + } + my_error(ER_UNKNOWN_COMPRESSION_METHOD, MYF(0), method); + return true; +} + + +bool Column_definition::set_compressed_deprecated(THD *thd, const char *method) +{ + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + ER_WARN_DEPRECATED_SYNTAX, + ER_THD(thd, ER_WARN_DEPRECATED_SYNTAX), + " ... COMPRESSED...", + "' COMPRESSED... ...'"); + return set_compressed(method); +} + + +bool +Column_definition::set_compressed_deprecated_column_attribute(THD *thd, + const char *pos, + const char *method) +{ + if (compression_method_ptr) + { + /* + Compression method has already been set, e.g.: + a VARCHAR(10) COMPRESSED DEFAULT 10 COMPRESSED + */ + thd->parse_error(ER_SYNTAX_ERROR, pos); + return true; + } enum enum_field_types sql_type= real_field_type(); /* We can't use f_is_blob here as pack_flag is not yet set */ if (sql_type == MYSQL_TYPE_VARCHAR || sql_type == MYSQL_TYPE_TINY_BLOB || sql_type == MYSQL_TYPE_BLOB || sql_type == MYSQL_TYPE_MEDIUM_BLOB || sql_type == MYSQL_TYPE_LONG_BLOB) - { - if (!method || !strcmp(method, zlib_compression_method->name)) - { - unireg_check= Field::TMYSQL_COMPRESSED; - compression_method_ptr= zlib_compression_method; - return false; - } - my_error(ER_UNKNOWN_COMPRESSION_METHOD, MYF(0), method); - } + return set_compressed_deprecated(thd, method); else my_error(ER_WRONG_FIELD_SPEC, MYF(0), field_name.str); return true; diff --git a/sql/field.h b/sql/field.h index 47952a4dfd8..3e5b84f9249 100644 --- a/sql/field.h +++ b/sql/field.h @@ -4559,6 +4559,10 @@ public: *this= *def; } bool set_compressed(const char *method); + bool set_compressed_deprecated(THD *thd, const char *method); + bool set_compressed_deprecated_column_attribute(THD *thd, + const char *pos, + const char *method); void set_compression_method(Compression_method *compression_method_arg) { compression_method_ptr= compression_method_arg; } Compression_method *compression_method() const diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 814017f0231..e844c500b77 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2092,7 +2092,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); ref_list opt_match_clause opt_on_update_delete use opt_delete_options opt_delete_option varchar nchar nvarchar opt_outer table_list table_name table_alias_ref_list table_alias_ref - opt_attribute opt_attribute_list attribute column_list column_list_id + attribute attribute_list + compressed_deprecated_data_type_attribute + compressed_deprecated_column_attribute + column_list column_list_id opt_column_list grant_privileges grant_ident grant_list grant_option object_privilege object_privilege_list user_list user_and_role_list rename_list table_or_tables @@ -6779,7 +6782,10 @@ opt_asrow_attribute_list: ; field_def: - opt_attribute + /* empty */ { } + | attribute_list + | attribute_list compressed_deprecated_column_attribute + | attribute_list compressed_deprecated_column_attribute attribute_list | opt_generated_always AS virtual_column_func { Lex->last_field->vcol_info= $3; @@ -6965,6 +6971,13 @@ field_type_numeric: ; +opt_binary_and_compression: + /* empty */ + | binary + | binary compressed_deprecated_data_type_attribute + | compressed opt_binary + ; + field_type_string: char opt_field_length_default_1 opt_binary { @@ -6980,25 +6993,25 @@ field_type_string: Lex->charset=&my_charset_bin; $$.set(&type_handler_string, $2); } - | varchar field_length opt_binary + | varchar field_length opt_binary_and_compression { $$.set(&type_handler_varchar, $2); } - | VARCHAR2_ORACLE_SYM field_length opt_binary + | VARCHAR2_ORACLE_SYM field_length opt_binary_and_compression { $$.set(&type_handler_varchar, $2); } - | nvarchar field_length opt_bin_mod + | nvarchar field_length opt_compressed opt_bin_mod { $$.set(&type_handler_varchar, $2); - bincmp_collation(national_charset_info, $3); + bincmp_collation(national_charset_info, $4); } - | VARBINARY field_length + | VARBINARY field_length opt_compressed { Lex->charset=&my_charset_bin; $$.set(&type_handler_varchar, $2); } - | RAW_ORACLE_SYM field_length + | RAW_ORACLE_SYM field_length opt_compressed { Lex->charset= &my_charset_bin; $$.set(&type_handler_varchar, $2); @@ -7064,17 +7077,17 @@ field_type_temporal: field_type_lob: - TINYBLOB + TINYBLOB opt_compressed { Lex->charset=&my_charset_bin; $$.set(&type_handler_tiny_blob); } - | BLOB_MARIADB_SYM opt_field_length + | BLOB_MARIADB_SYM opt_field_length opt_compressed { Lex->charset=&my_charset_bin; $$.set(&type_handler_blob, $2); } - | BLOB_ORACLE_SYM opt_field_length + | BLOB_ORACLE_SYM opt_field_length opt_compressed { Lex->charset=&my_charset_bin; $$.set(&type_handler_long_blob); @@ -7090,36 +7103,36 @@ field_type_lob: sym_group_geom.needed_define)); #endif } - | MEDIUMBLOB + | MEDIUMBLOB opt_compressed { Lex->charset=&my_charset_bin; $$.set(&type_handler_medium_blob); } - | LONGBLOB + | LONGBLOB opt_compressed { Lex->charset=&my_charset_bin; $$.set(&type_handler_long_blob); } - | LONG_SYM VARBINARY + | LONG_SYM VARBINARY opt_compressed { Lex->charset=&my_charset_bin; $$.set(&type_handler_medium_blob); } - | LONG_SYM varchar opt_binary + | LONG_SYM varchar opt_binary_and_compression { $$.set(&type_handler_medium_blob); } - | TINYTEXT opt_binary + | TINYTEXT opt_binary_and_compression { $$.set(&type_handler_tiny_blob); } - | TEXT_SYM opt_field_length opt_binary + | TEXT_SYM opt_field_length opt_binary_and_compression { $$.set(&type_handler_blob, $2); } - | MEDIUMTEXT opt_binary + | MEDIUMTEXT opt_binary_and_compression { $$.set(&type_handler_medium_blob); } - | LONGTEXT opt_binary + | LONGTEXT opt_binary_and_compression { $$.set(&type_handler_long_blob); } - | CLOB_ORACLE_SYM opt_binary + | CLOB_ORACLE_SYM opt_binary_and_compression { $$.set(&type_handler_long_blob); } - | LONG_SYM opt_binary + | LONG_SYM opt_binary_and_compression { $$.set(&type_handler_medium_blob); } - | JSON_SYM + | JSON_SYM opt_compressed { Lex->charset= &my_charset_utf8mb4_bin; $$.set(&type_handler_long_blob); @@ -7233,13 +7246,9 @@ opt_precision: | precision { $$= $1; } ; -opt_attribute: - /* empty */ {} - | opt_attribute_list {} - ; -opt_attribute_list: - opt_attribute_list attribute {} +attribute_list: + attribute_list attribute {} | attribute ; @@ -7267,11 +7276,6 @@ attribute: $2->name,Lex->charset->csname)); Lex->last_field->charset= $2; } - | COMPRESSED_SYM opt_compression_method - { - if (unlikely(Lex->last_field->set_compressed($2))) - MYSQL_YYABORT; - } | serial_attribute ; @@ -7280,6 +7284,36 @@ opt_compression_method: | equal ident { $$= $2.str; } ; +opt_compressed: + /* empty */ {} + | compressed { } + ; + +compressed: + COMPRESSED_SYM opt_compression_method + { + if (unlikely(Lex->last_field->set_compressed($2))) + MYSQL_YYABORT; + } + ; + +compressed_deprecated_data_type_attribute: + COMPRESSED_SYM opt_compression_method + { + if (unlikely(Lex->last_field->set_compressed_deprecated(thd, $2))) + MYSQL_YYABORT; + } + ; + +compressed_deprecated_column_attribute: + COMPRESSED_SYM opt_compression_method + { + if (unlikely(Lex->last_field-> + set_compressed_deprecated_column_attribute(thd, $1.pos(), $2))) + MYSQL_YYABORT; + } + ; + asrow_attribute: not NULL_SYM { @@ -7438,7 +7472,11 @@ charset_or_alias: opt_binary: /* empty */ { bincmp_collation(NULL, false); } - | BYTE_SYM { bincmp_collation(&my_charset_bin, false); } + | binary {} + ; + +binary: + BYTE_SYM { bincmp_collation(&my_charset_bin, false); } | charset_or_alias opt_bin_mod { bincmp_collation($1, $2); } | BINARY { bincmp_collation(NULL, true); } | BINARY charset_or_alias { bincmp_collation($2, true); } @@ -15713,6 +15751,7 @@ keyword_sp_var_not_label: | COLUMN_DELETE_SYM | COLUMN_GET_SYM | COMMENT_SYM + | COMPRESSED_SYM | DEALLOCATE_SYM | EXAMINED_SYM | EXCLUDE_SYM @@ -15925,7 +15964,6 @@ keyword_sp_var_and_label: | COMMITTED_SYM | COMPACT_SYM | COMPLETION_SYM - | COMPRESSED_SYM | CONCURRENT | CONNECTION_SYM | CONSISTENT_SYM diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy index fcf0dc01562..1ba77dcd16e 100644 --- a/sql/sql_yacc_ora.yy +++ b/sql/sql_yacc_ora.yy @@ -278,10 +278,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); %parse-param { THD *thd } %lex-param { THD *thd } /* - Currently there are 53 shift/reduce conflicts. + Currently there are 55 shift/reduce conflicts. We should not introduce new conflicts any more. */ -%expect 53 +%expect 55 /* Comments for TOKENS. @@ -1495,7 +1495,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); ref_list opt_match_clause opt_on_update_delete use opt_delete_options opt_delete_option varchar nchar nvarchar opt_outer table_list table_name table_alias_ref_list table_alias_ref - opt_attribute opt_attribute_list attribute column_list column_list_id + attribute attribute_list + compressed_deprecated_data_type_attribute + compressed_deprecated_column_attribute + column_list column_list_id opt_column_list grant_privileges grant_ident grant_list grant_option object_privilege object_privilege_list user_list user_and_role_list rename_list table_or_tables @@ -6625,7 +6628,10 @@ opt_asrow_attribute_list: ; field_def: - opt_attribute + /* empty */ { } + | attribute_list + | attribute_list compressed_deprecated_column_attribute + | attribute_list compressed_deprecated_column_attribute attribute_list | opt_generated_always AS virtual_column_func { Lex->last_field->vcol_info= $3; @@ -6821,6 +6827,13 @@ field_type_numeric: ; +opt_binary_and_compression: + /* empty */ + | binary + | binary compressed_deprecated_data_type_attribute + | compressed opt_binary + ; + field_type_string: char opt_field_length_default_1 opt_binary { @@ -6836,25 +6849,25 @@ field_type_string: Lex->charset=&my_charset_bin; $$.set(&type_handler_string, $2); } - | varchar field_length opt_binary + | varchar field_length opt_binary_and_compression { $$.set(&type_handler_varchar, $2); } - | VARCHAR2_ORACLE_SYM field_length opt_binary + | VARCHAR2_ORACLE_SYM field_length opt_binary_and_compression { $$.set(&type_handler_varchar, $2); } - | nvarchar field_length opt_bin_mod + | nvarchar field_length opt_compressed opt_bin_mod { $$.set(&type_handler_varchar, $2); - bincmp_collation(national_charset_info, $3); + bincmp_collation(national_charset_info, $4); } - | VARBINARY field_length + | VARBINARY field_length opt_compressed { Lex->charset=&my_charset_bin; $$.set(&type_handler_varchar, $2); } - | RAW_ORACLE_SYM field_length + | RAW_ORACLE_SYM field_length opt_compressed { Lex->charset= &my_charset_bin; $$.set(&type_handler_varchar, $2); @@ -6962,17 +6975,17 @@ field_type_temporal: field_type_lob: - TINYBLOB + TINYBLOB opt_compressed { Lex->charset=&my_charset_bin; $$.set(&type_handler_tiny_blob); } - | BLOB_MARIADB_SYM opt_field_length + | BLOB_MARIADB_SYM opt_field_length opt_compressed { Lex->charset=&my_charset_bin; $$.set(&type_handler_blob, $2); } - | BLOB_ORACLE_SYM opt_field_length + | BLOB_ORACLE_SYM opt_field_length opt_compressed { Lex->charset=&my_charset_bin; $$.set(&type_handler_long_blob); @@ -6988,36 +7001,36 @@ field_type_lob: sym_group_geom.needed_define)); #endif } - | MEDIUMBLOB + | MEDIUMBLOB opt_compressed { Lex->charset=&my_charset_bin; $$.set(&type_handler_medium_blob); } - | LONGBLOB + | LONGBLOB opt_compressed { Lex->charset=&my_charset_bin; $$.set(&type_handler_long_blob); } - | LONG_SYM VARBINARY + | LONG_SYM VARBINARY opt_compressed { Lex->charset=&my_charset_bin; $$.set(&type_handler_medium_blob); } - | LONG_SYM varchar opt_binary + | LONG_SYM varchar opt_binary_and_compression { $$.set(&type_handler_medium_blob); } - | TINYTEXT opt_binary + | TINYTEXT opt_binary_and_compression { $$.set(&type_handler_tiny_blob); } - | TEXT_SYM opt_field_length opt_binary + | TEXT_SYM opt_field_length opt_binary_and_compression { $$.set(&type_handler_blob, $2); } - | MEDIUMTEXT opt_binary + | MEDIUMTEXT opt_binary_and_compression { $$.set(&type_handler_medium_blob); } - | LONGTEXT opt_binary + | LONGTEXT opt_binary_and_compression { $$.set(&type_handler_long_blob); } - | CLOB_ORACLE_SYM opt_binary + | CLOB_ORACLE_SYM opt_binary_and_compression { $$.set(&type_handler_long_blob); } - | LONG_SYM opt_binary + | LONG_SYM opt_binary_and_compression { $$.set(&type_handler_medium_blob); } - | JSON_SYM + | JSON_SYM opt_compressed { Lex->charset= &my_charset_utf8mb4_bin; $$.set(&type_handler_long_blob); @@ -7157,13 +7170,9 @@ opt_precision: | precision { $$= $1; } ; -opt_attribute: - /* empty */ {} - | opt_attribute_list {} - ; -opt_attribute_list: - opt_attribute_list attribute {} +attribute_list: + attribute_list attribute {} | attribute ; @@ -7191,11 +7200,6 @@ attribute: $2->name,Lex->charset->csname)); Lex->last_field->charset= $2; } - | COMPRESSED_SYM opt_compression_method - { - if (unlikely(Lex->last_field->set_compressed($2))) - MYSQL_YYABORT; - } | serial_attribute ; @@ -7204,6 +7208,36 @@ opt_compression_method: | equal ident { $$= $2.str; } ; +opt_compressed: + /* empty */ {} + | compressed { } + ; + +compressed: + COMPRESSED_SYM opt_compression_method + { + if (unlikely(Lex->last_field->set_compressed($2))) + MYSQL_YYABORT; + } + ; + +compressed_deprecated_data_type_attribute: + COMPRESSED_SYM opt_compression_method + { + if (unlikely(Lex->last_field->set_compressed_deprecated(thd, $2))) + MYSQL_YYABORT; + } + ; + +compressed_deprecated_column_attribute: + COMPRESSED_SYM opt_compression_method + { + if (unlikely(Lex->last_field-> + set_compressed_deprecated_column_attribute(thd, $1.pos(), $2))) + MYSQL_YYABORT; + } + ; + asrow_attribute: not NULL_SYM { @@ -7375,7 +7409,11 @@ charset_or_alias: opt_binary: /* empty */ { bincmp_collation(NULL, false); } - | BYTE_SYM { bincmp_collation(&my_charset_bin, false); } + | binary {} + ; + +binary: + BYTE_SYM { bincmp_collation(&my_charset_bin, false); } | charset_or_alias opt_bin_mod { bincmp_collation($1, $2); } | BINARY { bincmp_collation(NULL, true); } | BINARY charset_or_alias { bincmp_collation($2, true); } @@ -15648,6 +15686,7 @@ keyword_label: | keyword_sp_var_and_label | keyword_sysvar_type | FUNCTION_SYM + | COMPRESSED_SYM ; keyword_sysvar_name: @@ -15717,6 +15756,7 @@ keyword_sp_var_not_label: | COLUMN_DELETE_SYM | COLUMN_GET_SYM | COMMENT_SYM + | COMPRESSED_SYM | DEALLOCATE_SYM | EXAMINED_SYM | EXCLUDE_SYM @@ -15929,7 +15969,6 @@ keyword_sp_var_and_label: | COMMITTED_SYM | COMPACT_SYM | COMPLETION_SYM - | COMPRESSED_SYM | CONCURRENT | CONNECTION_SYM | CONSISTENT_SYM