diff options
78 files changed, 4098 insertions, 516 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index c38ce6bc962..47ab7644a50 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -40,6 +40,7 @@ #include "my_readline.h" #include <signal.h> #include <violite.h> +#include <my_sys.h> #include <source_revision.h> #if defined(USE_LIBEDIT_INTERFACE) && defined(HAVE_LOCALE_H) #include <locale.h> @@ -4694,7 +4695,8 @@ sql_real_connect(char *host,char *database,char *user,char *password, select_limit,max_join_size); mysql_options(&mysql, MYSQL_INIT_COMMAND, init_command); } - + if (!strcmp(default_charset,MYSQL_AUTODETECT_CHARSET_NAME)) + default_charset= (char *)my_default_csname(); mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset); my_bool can_handle_expired= opt_connect_expired_password || !status.batch; diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index 10b56f10228..baffe98abb7 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2014, Oracle and/or its affiliates. - Copyright (c) 2010, 2017, MariaDB + Copyright (c) 2010, 2019, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,6 +26,7 @@ #include <welcome_copyright_notice.h> #include <my_rnd.h> #include <password.h> +#include <my_sys.h> #define ADMIN_VERSION "9.1" #define MAX_MYSQL_VAR 512 @@ -366,6 +367,8 @@ int main(int argc,char *argv[]) #endif if (opt_protocol) mysql_options(&mysql,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol); + if (!strcmp(default_charset,MYSQL_AUTODETECT_CHARSET_NAME)) + default_charset= (char *)my_default_csname(); mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset); error_flags= (myf)(opt_nobeep ? 0 : ME_BELL); diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 7eec7ee9f4f..7e9546e0dc2 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -434,8 +434,10 @@ static int get_options(int *argc, char ***argv) else default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME; } - if (strcmp(default_charset, MYSQL_AUTODETECT_CHARSET_NAME) && - !get_charset_by_csname(default_charset, MY_CS_PRIMARY, MYF(MY_WME))) + if (!strcmp(default_charset, MYSQL_AUTODETECT_CHARSET_NAME)) + default_charset= (char *)my_default_csname(); + + if (!get_charset_by_csname(default_charset, MY_CS_PRIMARY, MYF(MY_WME))) { printf("Unsupported character set: %s\n", default_charset); DBUG_RETURN(1); diff --git a/client/mysqlimport.c b/client/mysqlimport.c index 619def5f123..cfdb183414a 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -30,6 +30,8 @@ #define IMPORT_VERSION "3.7" #include "client_priv.h" +#include <my_sys.h> + #include "mysql_version.h" #include <welcome_copyright_notice.h> /* ORACLE_WELCOME_COPYRIGHT_NOTICE */ @@ -461,8 +463,9 @@ static MYSQL *db_connect(char *host, char *database, if (opt_default_auth && *opt_default_auth) mysql_options(mysql, MYSQL_DEFAULT_AUTH, opt_default_auth); - - mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset); + if (!strcmp(default_charset,MYSQL_AUTODETECT_CHARSET_NAME)) + default_charset= (char *)my_default_csname(); + mysql_options(mysql, MYSQL_SET_CHARSET_NAME, my_default_csname()); mysql_options(mysql, MYSQL_OPT_CONNECT_ATTR_RESET, 0); mysql_options4(mysql, MYSQL_OPT_CONNECT_ATTR_ADD, "program_name", "mysqlimport"); diff --git a/client/mysqlshow.c b/client/mysqlshow.c index 9885b219171..4e2f9e83340 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2015, Oracle and/or its affiliates. - Copyright (c) 2010, 2017, MariaDB + Copyright (c) 2010, 2019, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -130,6 +130,8 @@ int main(int argc, char **argv) if (opt_protocol) mysql_options(&mysql,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol); + if (!strcmp(default_charset,MYSQL_AUTODETECT_CHARSET_NAME)) + default_charset= (char *)my_default_csname(); mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset); if (opt_plugin_dir && *opt_plugin_dir) diff --git a/include/my_sys.h b/include/my_sys.h index 17cf1a1b53f..b216f5d2a41 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -1050,6 +1050,7 @@ extern char *get_tty_password(const char *opt_message); /* File system character set */ extern CHARSET_INFO *fs_character_set(void); #endif +extern const char *my_default_csname(void); extern size_t escape_quotes_for_mysql(CHARSET_INFO *charset_info, char *to, size_t to_length, const char *from, size_t length); 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/charset_client_win.result b/mysql-test/main/charset_client_win.result new file mode 100644 index 00000000000..08a32b0b80f --- /dev/null +++ b/mysql-test/main/charset_client_win.result @@ -0,0 +1,2 @@ +@@character_set_client +cp1257 diff --git a/mysql-test/main/charset_client_win.test b/mysql-test/main/charset_client_win.test new file mode 100644 index 00000000000..b4a21d4f0a4 --- /dev/null +++ b/mysql-test/main/charset_client_win.test @@ -0,0 +1,2 @@ +--source include/windows.inc +--exec chcp 1257 > NUL && $MYSQL --default-character-set=auto -e "select @@character_set_client" diff --git a/mysql-test/main/column_compression.result b/mysql-test/main/column_compression.result index 228b26dc67d..d9cc4aafac2 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` ( @@ -1487,6 +1491,1179 @@ 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 CHECK (json_valid(`a`)), + `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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 +# # End of 10.3 tests # # diff --git a/mysql-test/main/column_compression.test b/mysql-test/main/column_compression.test index 183fc38151c..bf311cb5097 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,12 +180,82 @@ 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); + --echo # --echo # End of 10.3 tests --echo # diff --git a/mysql-test/main/func_time.result b/mysql-test/main/func_time.result index 8546a7bc84b..0b5fb46c1d5 100644 --- a/mysql-test/main/func_time.result +++ b/mysql-test/main/func_time.result @@ -6345,3 +6345,9 @@ NULL SELECT CONCAT(MAKETIME('01', '01', LEAST( -100, NULL ))); CONCAT(MAKETIME('01', '01', LEAST( -100, NULL ))) NULL +# +# MDEV-19774 Assertion `sec.se c() <= 0x7FFFFFFFL' failed in Item_func_from_unixtime::get_date +# +SELECT FROM_UNIXTIME(LEAST(3696610869, NULL)); +FROM_UNIXTIME(LEAST(3696610869, NULL)) +NULL diff --git a/mysql-test/main/func_time.test b/mysql-test/main/func_time.test index 5760553e0dd..2e44df5a0d0 100644 --- a/mysql-test/main/func_time.test +++ b/mysql-test/main/func_time.test @@ -3170,3 +3170,10 @@ SET time_zone=DEFAULT; SELECT MAKETIME('01', '01', LEAST( -100, NULL )); SELECT CONCAT(MAKETIME('01', '01', LEAST( -100, NULL ))); + + +--echo # +--echo # MDEV-19774 Assertion `sec.se c() <= 0x7FFFFFFFL' failed in Item_func_from_unixtime::get_date +--echo # + +SELECT FROM_UNIXTIME(LEAST(3696610869, NULL)); diff --git a/mysql-test/main/grant5.result b/mysql-test/main/grant5.result index 086ae7011e4..2f16c5d630a 100644 --- a/mysql-test/main/grant5.result +++ b/mysql-test/main/grant5.result @@ -127,3 +127,6 @@ disconnect conn1; connection default; drop database mysqltest_1; drop user twg@'%'; +insert mysql.tables_priv (host,db,user,table_name,grantor,table_priv) values ('localhost','','otto','t1','root@localhost','select'); +flush privileges; +delete from mysql.tables_priv where db=''; diff --git a/mysql-test/main/grant5.test b/mysql-test/main/grant5.test index 4db262c25c1..43f5b9c180f 100644 --- a/mysql-test/main/grant5.test +++ b/mysql-test/main/grant5.test @@ -124,3 +124,10 @@ connection default; drop database mysqltest_1; drop user twg@'%'; + +# +# test the empty db case +# +insert mysql.tables_priv (host,db,user,table_name,grantor,table_priv) values ('localhost','','otto','t1','root@localhost','select'); +flush privileges; +delete from mysql.tables_priv where db=''; 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 - <table>_orig +SET @orig_table_name = CONCAT('test.t1', '_orig'); +# Rename original table +ALTER TABLE test.t1 RENAME to test.t1_orig; +# Recreate table from mysqldump output +# Compare original and recreated tables +# Recreated table: test.t1 +# Original table: test.t1_orig +include/diff_tables.inc [test.t1, test.t1_orig] +# Cleanup +DROP TABLE test.t1, test.t1_orig; +CREATE TABLE t1 (a LONGTEXT COMPRESSED CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL); +INSERT INTO `t1` VALUES (REPEAT('a', 256)); +# Begin testing mysqldump output + restore +# Create 'original table name - <table>_orig +SET @orig_table_name = CONCAT('test.t1', '_orig'); +# Rename original table +ALTER TABLE test.t1 RENAME to test.t1_orig; +# Recreate table from mysqldump output +# Compare original and recreated tables +# Recreated table: test.t1 +# Original table: test.t1_orig +include/diff_tables.inc [test.t1, test.t1_orig] +# Cleanup +DROP TABLE test.t1, test.t1_orig; +# +# End of 10.3 tests +# # 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 5908ee24ad4..b812334470b 100644 --- a/mysql-test/main/sp.result +++ b/mysql-test/main/sp.result @@ -8791,6 +8791,33 @@ 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 # # Start of 10.4 tests diff --git a/mysql-test/main/sp.test b/mysql-test/main/sp.test index 920b09077d3..7f413c4f665 100644 --- a/mysql-test/main/sp.test +++ b/mysql-test/main/sp.test @@ -10322,6 +10322,32 @@ 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..4eb55f47e51 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 CHECK (json_valid("a")), + "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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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 '<data type> <character set clause> ... COMPRESSED...' is deprecated and will be removed in a future release. Please use '<data type> COMPRESSED... <character set clause> ...' 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; +<<compressed>> +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 - <table>_orig +SET @orig_table_name = CONCAT('test.t1', '_orig'); +# Rename original table +ALTER TABLE test.t1 RENAME to test.t1_orig; +# Recreate table from mysqldump output +# Compare original and recreated tables +# Recreated table: test.t1 +# Original table: test.t1_orig +include/diff_tables.inc [test.t1, test.t1_orig] +# Cleanup +DROP TABLE test.t1, test.t1_orig; +CREATE TABLE t1 (a LONGTEXT COMPRESSED CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL); +INSERT INTO `t1` VALUES (REPEAT('a', 256)); +# Begin testing mysqldump output + restore +# Create 'original table name - <table>_orig +SET @orig_table_name = CONCAT('test.t1', '_orig'); +# Rename original table +ALTER TABLE test.t1 RENAME to test.t1_orig; +# Recreate table from mysqldump output +# Compare original and recreated tables +# Recreated table: test.t1 +# Original table: test.t1_orig +include/diff_tables.inc [test.t1, test.t1_orig] +# Cleanup +DROP TABLE test.t1, test.t1_orig; +# +# End of 10.3 tests +# 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; +<<compressed>> + 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/mysql-test/suite/galera/r/MDEV-18832.result b/mysql-test/suite/galera/r/MDEV-18832.result new file mode 100644 index 00000000000..700a0bbefb1 --- /dev/null +++ b/mysql-test/suite/galera/r/MDEV-18832.result @@ -0,0 +1,14 @@ +connection node_2; +connection node_1; +CREATE SEQUENCE Seq1_1 START WITH 1 INCREMENT BY 1; +CREATE TABLE t1 (Id int(11) NOT NULL, PRIMARY KEY (Id)); +INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1); +INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1); +INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1); +INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1); +DROP SEQUENCE Seq1_1; +CREATE SEQUENCE Seq1_1 START WITH 1 INCREMENT BY 1; +INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1); +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +DROP SEQUENCE Seq1_1; +DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/MDEV-18832.cnf b/mysql-test/suite/galera/t/MDEV-18832.cnf new file mode 100644 index 00000000000..4c62448fe3d --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-18832.cnf @@ -0,0 +1,4 @@ +!include ../galera_2nodes.cnf + +[mysqld] +log-bin diff --git a/mysql-test/suite/galera/t/MDEV-18832.test b/mysql-test/suite/galera/t/MDEV-18832.test new file mode 100644 index 00000000000..e2f1b2afd45 --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-18832.test @@ -0,0 +1,15 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +CREATE SEQUENCE Seq1_1 START WITH 1 INCREMENT BY 1; +CREATE TABLE t1 (Id int(11) NOT NULL, PRIMARY KEY (Id)); +INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1); +INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1); +INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1); +INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1); +DROP SEQUENCE Seq1_1; +CREATE SEQUENCE Seq1_1 START WITH 1 INCREMENT BY 1; +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1); +DROP SEQUENCE Seq1_1; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/instant_alter_charset.result b/mysql-test/suite/innodb/r/instant_alter_charset.result index 82d6ce899c0..2e278ac54f4 100644 --- a/mysql-test/suite/innodb/r/instant_alter_charset.result +++ b/mysql-test/suite/innodb/r/instant_alter_charset.result @@ -176,11 +176,11 @@ algorithm=instant; ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY drop table enum_and_set; create table compressed ( -a varchar(255) charset utf8mb3 compressed +a varchar(255) compressed charset utf8mb3 ) engine=innodb; insert into compressed values ('AAA'), ('bbb'), ('CCC'); alter table compressed -modify a varchar(255) charset utf8mb4 compressed, +modify a varchar(255) compressed charset utf8mb4, algorithm=instant; select * from compressed; a diff --git a/mysql-test/suite/innodb/t/instant_alter_charset.test b/mysql-test/suite/innodb/t/instant_alter_charset.test index 8c2d6112c8c..8259689a139 100644 --- a/mysql-test/suite/innodb/t/instant_alter_charset.test +++ b/mysql-test/suite/innodb/t/instant_alter_charset.test @@ -208,13 +208,13 @@ alter table enum_and_set drop table enum_and_set; create table compressed ( - a varchar(255) charset utf8mb3 compressed + a varchar(255) compressed charset utf8mb3 ) engine=innodb; insert into compressed values ('AAA'), ('bbb'), ('CCC'); alter table compressed - modify a varchar(255) charset utf8mb4 compressed, + modify a varchar(255) compressed charset utf8mb4, algorithm=instant; select * from compressed; diff --git a/mysql-test/suite/maria/alter.result b/mysql-test/suite/maria/alter.result index c63688dddd6..c2ddc813cdc 100644 --- a/mysql-test/suite/maria/alter.result +++ b/mysql-test/suite/maria/alter.result @@ -47,3 +47,46 @@ t1 CREATE TABLE `t1` ( ) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1 CREATE TABLE t2 SELECT * FROM t1; DROP TABLE t1, t2; +# +# MDEV-19055 Assertion `(_my_thread_var())->thr_errno != 0' failed in pagecache_read +# +CREATE OR REPLACE TABLE t1 (x INT) ENGINE=Aria; +CREATE TEMPORARY TABLE t2 (a TIME) ENGINE=Aria; +ALTER TABLE t2 ADD b DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP; +ALTER TABLE t2 ADD CHECK (b = 4); +INSERT IGNORE INTO t2 () VALUES (),(),(),(); +ALTER IGNORE TABLE t2 ADD c INT; +SELECT count(a),sum(a) FROM t2; +count(a) sum(a) +0 NULL +DELETE FROM t2 ORDER BY c LIMIT 1; +INSERT IGNORE INTO t2 SELECT * FROM t2; +OPTIMIZE TABLE t2; +Table Op Msg_type Msg_text +test.t2 optimize status OK +SELECT count(a),sum(a) FROM t2; +count(a) sum(a) +0 NULL +INSERT IGNORE INTO t2 SELECT * FROM t2; +SET SQL_MODE= 'STRICT_ALL_TABLES'; +SELECT count(a),sum(a) FROM t2; +count(a) sum(a) +0 NULL +ALTER TABLE t2 CHANGE IF EXISTS d c INT; +ERROR 22007: Truncated incorrect datetime value: '4' +SELECT count(a),sum(a) FROM t2; +count(a) sum(a) +0 NULL +ALTER IGNORE TABLE t2 ADD IF NOT EXISTS e BIT; +ALTER TABLE t1 MODIFY IF EXISTS xx INT; +INSERT IGNORE INTO t2 () VALUES (),(),(),(); +SELECT count(a),sum(a) FROM t2; +count(a) sum(a) +0 NULL +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +check table t2; +Table Op Msg_type Msg_text +test.t2 check status OK +DROP TABLE t1,t2; diff --git a/mysql-test/suite/maria/alter.test b/mysql-test/suite/maria/alter.test index 09672cdfa3b..ef21ab2e5d2 100644 --- a/mysql-test/suite/maria/alter.test +++ b/mysql-test/suite/maria/alter.test @@ -42,3 +42,38 @@ ALTER TABLE t1 ORDER BY unknown_column; SHOW CREATE TABLE t1; CREATE TABLE t2 SELECT * FROM t1; DROP TABLE t1, t2; + +--echo # +--echo # MDEV-19055 Assertion `(_my_thread_var())->thr_errno != 0' failed in pagecache_read +--echo # + +--disable_warnings +CREATE OR REPLACE TABLE t1 (x INT) ENGINE=Aria; +CREATE TEMPORARY TABLE t2 (a TIME) ENGINE=Aria; +ALTER TABLE t2 ADD b DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP; +ALTER TABLE t2 ADD CHECK (b = 4); +INSERT IGNORE INTO t2 () VALUES (),(),(),(); +ALTER IGNORE TABLE t2 ADD c INT; +SELECT count(a),sum(a) FROM t2; +DELETE FROM t2 ORDER BY c LIMIT 1; +INSERT IGNORE INTO t2 SELECT * FROM t2; +OPTIMIZE TABLE t2; +SELECT count(a),sum(a) FROM t2; +INSERT IGNORE INTO t2 SELECT * FROM t2; +SET SQL_MODE= 'STRICT_ALL_TABLES'; +SELECT count(a),sum(a) FROM t2; +--error ER_TRUNCATED_WRONG_VALUE +ALTER TABLE t2 CHANGE IF EXISTS d c INT; +SELECT count(a),sum(a) FROM t2; +ALTER IGNORE TABLE t2 ADD IF NOT EXISTS e BIT; +ALTER TABLE t1 MODIFY IF EXISTS xx INT; +INSERT IGNORE INTO t2 () VALUES (),(),(),(); +SELECT count(a),sum(a) FROM t2; +--enable_warnings +check table t1; +check table t2; +DROP TABLE t1,t2; + +# +# End of 10.2 tests +# diff --git a/mysql-test/suite/maria/temporary.result b/mysql-test/suite/maria/temporary.result new file mode 100644 index 00000000000..2592e04be2b --- /dev/null +++ b/mysql-test/suite/maria/temporary.result @@ -0,0 +1,23 @@ +CREATE TABLE t1 (b INT); +INSERT INTO t1 VALUES (5); +CREATE TEMPORARY TABLE t1 (a INT) ENGINE=Aria ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES (1); +DELETE FROM t1 LIMIT 2; +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1; +a +INSERT INTO t1 VALUES (1),(2); +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +ALTER TABLE t1 CHANGE COLUMN IF EXISTS x x INT; +Warnings: +Note 1054 Unknown column 'x' in 't1' +ALTER TABLE t1; +DROP TEMPORARY TABLE t1; +DROP TABLE t1; diff --git a/mysql-test/suite/maria/temporary.test b/mysql-test/suite/maria/temporary.test new file mode 100644 index 00000000000..76f8e2526a4 --- /dev/null +++ b/mysql-test/suite/maria/temporary.test @@ -0,0 +1,20 @@ +# +# MDEV-19595 +# ER_CRASHED_ON_USAGE and Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' +# failed upon actions on temporary Aria table with ROW_FORMAT DYNAMIC +# + +CREATE TABLE t1 (b INT); +INSERT INTO t1 VALUES (5); +CREATE TEMPORARY TABLE t1 (a INT) ENGINE=Aria ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES (1); +DELETE FROM t1 LIMIT 2; +OPTIMIZE TABLE t1; +CHECK TABLE t1; +SELECT * FROM t1; +INSERT INTO t1 VALUES (1),(2); +CHECK TABLE t1; +ALTER TABLE t1 CHANGE COLUMN IF EXISTS x x INT; +ALTER TABLE t1; +DROP TEMPORARY TABLE t1; +DROP TABLE t1; diff --git a/mysql-test/suite/vcol/r/vcol_misc.result b/mysql-test/suite/vcol/r/vcol_misc.result index c3321872a45..6afdd120d26 100644 --- a/mysql-test/suite/vcol/r/vcol_misc.result +++ b/mysql-test/suite/vcol/r/vcol_misc.result @@ -223,10 +223,10 @@ drop table t1; create table t1 (a int, b int); insert into t1 values (3, 30), (4, 20), (1, 20); create table t2 (c int, d int, v int as (d+1), index idx(c)); -insert into t2(c,d) values +insert into t2(c,d) values (20, 100), (20, 300), (30, 100), (30, 200), (40, 500), (70, 100), (40, 300), (60, 100), (40, 100), (70, 100); -insert into t2(c,d) values +insert into t2(c,d) values (120, 100), (150, 300), (130, 100), (130, 200), (140, 500), (170, 100), (180, 300), (160, 100), (40, 100), (170, 100); set join_cache_level=6; @@ -443,5 +443,43 @@ ERROR HY000: Incorrect information in file: './test/t1.frm' ALTER TABLE t1; ERROR HY000: Incorrect information in file: './test/t1.frm' # +# MDEV-19771 REPLACE on table with virtual_field can cause crash in set_ok_status() + +create or replace table t1 (pk int primary key, col_bit bit(15) default null, +vcol_bit bit(10) GENERATED ALWAYS AS (`col_bit`) VIRTUAL); +replace INTO `t1` (`pk`,col_bit) VALUES (99,1000); +select pk, col_bit+0, vcol_bit+0 from t1; +pk col_bit+0 vcol_bit+0 +99 1000 1000 +replace INTO `t1` (`pk`,col_bit) VALUES (99,10000); +select pk, col_bit+0, vcol_bit+0 from t1; +pk col_bit+0 vcol_bit+0 +99 10000 1023 +REPLACE LOW_PRIORITY INTO `t1` (`pk`) VALUES (99); +Warnings: +Warning 1264 Out of range value for column 'vcol_bit' at row 1 +drop table t1; +# +# MDEV-17837 REPLACE on table with virtual_field can cause crash in set_ok_status() +# +SET @old_sql_mode=@@sql_mode; +SET sql_mode= STRICT_ALL_TABLES; +CREATE TABLE t1 ( +pk INT, +i TINYINT, +vi TINYINT AS (i+1) PERSISTENT, +PRIMARY KEY(pk) +); +INSERT INTO t1 (pk,i) VALUES (1,1); +TRUNCATE TABLE t1; +INSERT IGNORE INTO t1 (pk,i) VALUES (1,127); +Warnings: +Warning 1264 Out of range value for column 'vi' at row 1 +REPLACE INTO t1 (pk,i) VALUES (1,2); +Warnings: +Warning 1264 Out of range value for column 'vi' at row 1 +DROP TABLE t1; +SET @sql_mode=@old_sql_mode; +# # End of 10.2 tests # diff --git a/mysql-test/suite/vcol/t/vcol_misc.test b/mysql-test/suite/vcol/t/vcol_misc.test index 4e6bd169b7d..39f4f4142e6 100644 --- a/mysql-test/suite/vcol/t/vcol_misc.test +++ b/mysql-test/suite/vcol/t/vcol_misc.test @@ -232,12 +232,12 @@ drop table t1; create table t1 (a int, b int); insert into t1 values (3, 30), (4, 20), (1, 20); create table t2 (c int, d int, v int as (d+1), index idx(c)); -insert into t2(c,d) values +insert into t2(c,d) values (20, 100), (20, 300), (30, 100), (30, 200), (40, 500), - (70, 100), (40, 300), (60, 100), (40, 100), (70, 100); -insert into t2(c,d) values + (70, 100), (40, 300), (60, 100), (40, 100), (70, 100); +insert into t2(c,d) values (120, 100), (150, 300), (130, 100), (130, 200), (140, 500), - (170, 100), (180, 300), (160, 100), (40, 100), (170, 100); + (170, 100), (180, 300), (160, 100), (40, 100), (170, 100); set join_cache_level=6; explain @@ -409,5 +409,39 @@ ALTER TABLE t1; --remove_file $MYSQLD_DATADIR/test/t1.frm --echo # +--echo # MDEV-19771 REPLACE on table with virtual_field can cause crash in set_ok_status() +--echo + +create or replace table t1 (pk int primary key, col_bit bit(15) default null, + vcol_bit bit(10) GENERATED ALWAYS AS (`col_bit`) VIRTUAL); +replace INTO `t1` (`pk`,col_bit) VALUES (99,1000); +select pk, col_bit+0, vcol_bit+0 from t1; +replace INTO `t1` (`pk`,col_bit) VALUES (99,10000); +select pk, col_bit+0, vcol_bit+0 from t1; +REPLACE LOW_PRIORITY INTO `t1` (`pk`) VALUES (99); +drop table t1; + +--echo # +--echo # MDEV-17837 REPLACE on table with virtual_field can cause crash in set_ok_status() +--echo # + +SET @old_sql_mode=@@sql_mode; +SET sql_mode= STRICT_ALL_TABLES; + +CREATE TABLE t1 ( + pk INT, + i TINYINT, + vi TINYINT AS (i+1) PERSISTENT, + PRIMARY KEY(pk) +); + +INSERT INTO t1 (pk,i) VALUES (1,1); +TRUNCATE TABLE t1; +INSERT IGNORE INTO t1 (pk,i) VALUES (1,127); +REPLACE INTO t1 (pk,i) VALUES (1,2); +DROP TABLE t1; +SET @sql_mode=@old_sql_mode; + +--echo # --echo # End of 10.2 tests --echo # diff --git a/mysys/charset.c b/mysys/charset.c index 51afbb16cf0..f44dc7606c1 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -20,7 +20,12 @@ #include <m_string.h> #include <my_dir.h> #include <my_xml.h> - +#ifdef HAVE_LANGINFO_H +#include <langinfo.h> +#endif +#ifdef HAVE_LOCALE_H +#include <locale.h> +#endif /* The code below implements this functionality: @@ -1216,3 +1221,214 @@ size_t escape_quotes_for_mysql(CHARSET_INFO *charset_info, *to= 0; return overflow ? (ulong)~0 : (ulong) (to - to_start); } + + +typedef enum my_cs_match_type_enum +{ + /* MySQL and OS charsets are fully compatible */ + my_cs_exact, + /* MySQL charset is very close to OS charset */ + my_cs_approx, + /* + MySQL knows this charset, but it is not supported as client character set. + */ + my_cs_unsupp +} my_cs_match_type; + + +typedef struct str2str_st +{ + const char* os_name; + const char* my_name; + my_cs_match_type param; +} MY_CSET_OS_NAME; + +static const MY_CSET_OS_NAME charsets[] = +{ +#ifdef _WIN32 + {"cp437", "cp850", my_cs_approx}, + {"cp850", "cp850", my_cs_exact}, + {"cp852", "cp852", my_cs_exact}, + {"cp858", "cp850", my_cs_approx}, + {"cp866", "cp866", my_cs_exact}, + {"cp874", "tis620", my_cs_approx}, + {"cp932", "cp932", my_cs_exact}, + {"cp936", "gbk", my_cs_approx}, + {"cp949", "euckr", my_cs_approx}, + {"cp950", "big5", my_cs_exact}, + {"cp1200", "utf16le", my_cs_unsupp}, + {"cp1201", "utf16", my_cs_unsupp}, + {"cp1250", "cp1250", my_cs_exact}, + {"cp1251", "cp1251", my_cs_exact}, + {"cp1252", "latin1", my_cs_exact}, + {"cp1253", "greek", my_cs_exact}, + {"cp1254", "latin5", my_cs_exact}, + {"cp1255", "hebrew", my_cs_approx}, + {"cp1256", "cp1256", my_cs_exact}, + {"cp1257", "cp1257", my_cs_exact}, + {"cp10000", "macroman", my_cs_exact}, + {"cp10001", "sjis", my_cs_approx}, + {"cp10002", "big5", my_cs_approx}, + {"cp10008", "gb2312", my_cs_approx}, + {"cp10021", "tis620", my_cs_approx}, + {"cp10029", "macce", my_cs_exact}, + {"cp12001", "utf32", my_cs_unsupp}, + {"cp20107", "swe7", my_cs_exact}, + {"cp20127", "latin1", my_cs_approx}, + {"cp20866", "koi8r", my_cs_exact}, + {"cp20932", "ujis", my_cs_exact}, + {"cp20936", "gb2312", my_cs_approx}, + {"cp20949", "euckr", my_cs_approx}, + {"cp21866", "koi8u", my_cs_exact}, + {"cp28591", "latin1", my_cs_approx}, + {"cp28592", "latin2", my_cs_exact}, + {"cp28597", "greek", my_cs_exact}, + {"cp28598", "hebrew", my_cs_exact}, + {"cp28599", "latin5", my_cs_exact}, + {"cp28603", "latin7", my_cs_exact}, +#ifdef UNCOMMENT_THIS_WHEN_WL_4579_IS_DONE + {"cp28605", "latin9", my_cs_exact}, +#endif + {"cp38598", "hebrew", my_cs_exact}, + {"cp51932", "ujis", my_cs_exact}, + {"cp51936", "gb2312", my_cs_exact}, + {"cp51949", "euckr", my_cs_exact}, + {"cp51950", "big5", my_cs_exact}, +#ifdef UNCOMMENT_THIS_WHEN_WL_WL_4024_IS_DONE + {"cp54936", "gb18030", my_cs_exact}, +#endif + {"cp65001", "utf8", my_cs_exact}, + +#else /* not Windows */ + + {"646", "latin1", my_cs_approx}, /* Default on Solaris */ + {"ANSI_X3.4-1968", "latin1", my_cs_approx}, + {"ansi1251", "cp1251", my_cs_exact}, + {"armscii8", "armscii8", my_cs_exact}, + {"armscii-8", "armscii8", my_cs_exact}, + {"ASCII", "latin1", my_cs_approx}, + {"Big5", "big5", my_cs_exact}, + {"cp1251", "cp1251", my_cs_exact}, + {"cp1255", "hebrew", my_cs_approx}, + {"CP866", "cp866", my_cs_exact}, + {"eucCN", "gb2312", my_cs_exact}, + {"euc-CN", "gb2312", my_cs_exact}, + {"eucJP", "ujis", my_cs_exact}, + {"euc-JP", "ujis", my_cs_exact}, + {"eucKR", "euckr", my_cs_exact}, + {"euc-KR", "euckr", my_cs_exact}, +#ifdef UNCOMMENT_THIS_WHEN_WL_WL_4024_IS_DONE + {"gb18030", "gb18030", my_cs_exact}, +#endif + {"gb2312", "gb2312", my_cs_exact}, + {"gbk", "gbk", my_cs_exact}, + {"georgianps", "geostd8", my_cs_exact}, + {"georgian-ps", "geostd8", my_cs_exact}, + {"IBM-1252", "cp1252", my_cs_exact}, + + {"iso88591", "latin1", my_cs_approx}, + {"ISO_8859-1", "latin1", my_cs_approx}, + {"ISO8859-1", "latin1", my_cs_approx}, + {"ISO-8859-1", "latin1", my_cs_approx}, + + {"iso885913", "latin7", my_cs_exact}, + {"ISO_8859-13", "latin7", my_cs_exact}, + {"ISO8859-13", "latin7", my_cs_exact}, + {"ISO-8859-13", "latin7", my_cs_exact}, + +#ifdef UNCOMMENT_THIS_WHEN_WL_4579_IS_DONE + {"iso885915", "latin9", my_cs_exact}, + {"ISO_8859-15", "latin9", my_cs_exact}, + {"ISO8859-15", "latin9", my_cs_exact}, + {"ISO-8859-15", "latin9", my_cs_exact}, +#endif + + {"iso88592", "latin2", my_cs_exact}, + {"ISO_8859-2", "latin2", my_cs_exact}, + {"ISO8859-2", "latin2", my_cs_exact}, + {"ISO-8859-2", "latin2", my_cs_exact}, + + {"iso88597", "greek", my_cs_exact}, + {"ISO_8859-7", "greek", my_cs_exact}, + {"ISO8859-7", "greek", my_cs_exact}, + {"ISO-8859-7", "greek", my_cs_exact}, + + {"iso88598", "hebrew", my_cs_exact}, + {"ISO_8859-8", "hebrew", my_cs_exact}, + {"ISO8859-8", "hebrew", my_cs_exact}, + {"ISO-8859-8", "hebrew", my_cs_exact}, + + {"iso88599", "latin5", my_cs_exact}, + {"ISO_8859-9", "latin5", my_cs_exact}, + {"ISO8859-9", "latin5", my_cs_exact}, + {"ISO-8859-9", "latin5", my_cs_exact}, + + {"koi8r", "koi8r", my_cs_exact}, + {"KOI8-R", "koi8r", my_cs_exact}, + {"koi8u", "koi8u", my_cs_exact}, + {"KOI8-U", "koi8u", my_cs_exact}, + + {"roman8", "hp8", my_cs_exact}, /* Default on HP UX */ + + {"Shift_JIS", "sjis", my_cs_exact}, + {"SJIS", "sjis", my_cs_exact}, + {"shiftjisx0213", "sjis", my_cs_exact}, + + {"tis620", "tis620", my_cs_exact}, + {"tis-620", "tis620", my_cs_exact}, + + {"ujis", "ujis", my_cs_exact}, + + {"US-ASCII", "latin1", my_cs_approx}, + + {"utf8", "utf8", my_cs_exact}, + {"utf-8", "utf8", my_cs_exact}, +#endif + {NULL, NULL, 0} +}; + + +static const char* +my_os_charset_to_mysql_charset(const char* csname) +{ + const MY_CSET_OS_NAME* csp; + for (csp = charsets; csp->os_name; csp++) + { + if (!strcasecmp(csp->os_name, csname)) + { + switch (csp->param) + { + case my_cs_exact: + return csp->my_name; + + case my_cs_approx: + /* + Maybe we should print a warning eventually: + character set correspondence is not exact. + */ + return csp->my_name; + + default: + return NULL; + } + } + } + return NULL; +} + +const char* my_default_csname() +{ + const char* csname = NULL; +#ifdef _WIN32 + char cpbuf[64]; + int cp = GetConsoleCP(); + if (cp == 0) + cp = GetACP(); + snprintf(cpbuf, sizeof(cpbuf), "cp%d", (int)cp); + csname = my_os_charset_to_mysql_charset(cpbuf); +#elif defined(HAVE_SETLOCALE) && defined(HAVE_NL_LANGINFO) + if (setlocale(LC_CTYPE, "") && (csname = nl_langinfo(CODESET))) + csname = my_os_charset_to_mysql_charset(csname); +#endif + return csname ? csname : MYSQL_DEFAULT_CHARSET_NAME; +}
\ No newline at end of file diff --git a/mysys/my_pread.c b/mysys/my_pread.c index 69a4ca08b78..56cc91ae083 100644 --- a/mysys/my_pread.c +++ b/mysys/my_pread.c @@ -68,6 +68,8 @@ size_t my_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset, if (readbytes != Count) { + /* We should never read with wrong file descriptor! */ + DBUG_ASSERT(readbytes != (size_t)-1 || errno != EBADF); my_errno= errno; if (errno == 0 || (readbytes != (size_t) -1 && (MyFlags & (MY_NABP | MY_FNABP)))) diff --git a/sql-common/client.c b/sql-common/client.c index ae657023772..0546188f4d5 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1,5 +1,5 @@ /* Copyright (c) 2003, 2016, Oracle and/or its affiliates. - Copyright (c) 2009, 2017, MariaDB + Copyright (c) 2009, 2019, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1660,250 +1660,13 @@ static MYSQL_METHODS client_methods= }; - -typedef enum my_cs_match_type_enum -{ - /* MySQL and OS charsets are fully compatible */ - my_cs_exact, - /* MySQL charset is very close to OS charset */ - my_cs_approx, - /* - MySQL knows this charset, but it is not supported as client character set. - */ - my_cs_unsupp -} my_cs_match_type; - - -typedef struct str2str_st -{ - const char *os_name; - const char *my_name; - my_cs_match_type param; -} MY_CSET_OS_NAME; - -const MY_CSET_OS_NAME charsets[]= -{ -#ifdef _WIN32 - {"cp437", "cp850", my_cs_approx}, - {"cp850", "cp850", my_cs_exact}, - {"cp852", "cp852", my_cs_exact}, - {"cp858", "cp850", my_cs_approx}, - {"cp866", "cp866", my_cs_exact}, - {"cp874", "tis620", my_cs_approx}, - {"cp932", "cp932", my_cs_exact}, - {"cp936", "gbk", my_cs_approx}, - {"cp949", "euckr", my_cs_approx}, - {"cp950", "big5", my_cs_exact}, - {"cp1200", "utf16le", my_cs_unsupp}, - {"cp1201", "utf16", my_cs_unsupp}, - {"cp1250", "cp1250", my_cs_exact}, - {"cp1251", "cp1251", my_cs_exact}, - {"cp1252", "latin1", my_cs_exact}, - {"cp1253", "greek", my_cs_exact}, - {"cp1254", "latin5", my_cs_exact}, - {"cp1255", "hebrew", my_cs_approx}, - {"cp1256", "cp1256", my_cs_exact}, - {"cp1257", "cp1257", my_cs_exact}, - {"cp10000", "macroman", my_cs_exact}, - {"cp10001", "sjis", my_cs_approx}, - {"cp10002", "big5", my_cs_approx}, - {"cp10008", "gb2312", my_cs_approx}, - {"cp10021", "tis620", my_cs_approx}, - {"cp10029", "macce", my_cs_exact}, - {"cp12001", "utf32", my_cs_unsupp}, - {"cp20107", "swe7", my_cs_exact}, - {"cp20127", "latin1", my_cs_approx}, - {"cp20866", "koi8r", my_cs_exact}, - {"cp20932", "ujis", my_cs_exact}, - {"cp20936", "gb2312", my_cs_approx}, - {"cp20949", "euckr", my_cs_approx}, - {"cp21866", "koi8u", my_cs_exact}, - {"cp28591", "latin1", my_cs_approx}, - {"cp28592", "latin2", my_cs_exact}, - {"cp28597", "greek", my_cs_exact}, - {"cp28598", "hebrew", my_cs_exact}, - {"cp28599", "latin5", my_cs_exact}, - {"cp28603", "latin7", my_cs_exact}, -#ifdef UNCOMMENT_THIS_WHEN_WL_4579_IS_DONE - {"cp28605", "latin9", my_cs_exact}, -#endif - {"cp38598", "hebrew", my_cs_exact}, - {"cp51932", "ujis", my_cs_exact}, - {"cp51936", "gb2312", my_cs_exact}, - {"cp51949", "euckr", my_cs_exact}, - {"cp51950", "big5", my_cs_exact}, -#ifdef UNCOMMENT_THIS_WHEN_WL_WL_4024_IS_DONE - {"cp54936", "gb18030", my_cs_exact}, -#endif - {"cp65001", "utf8", my_cs_exact}, - -#else /* not Windows */ - - {"646", "latin1", my_cs_approx}, /* Default on Solaris */ - {"ANSI_X3.4-1968", "latin1", my_cs_approx}, - {"ansi1251", "cp1251", my_cs_exact}, - {"armscii8", "armscii8", my_cs_exact}, - {"armscii-8", "armscii8", my_cs_exact}, - {"ASCII", "latin1", my_cs_approx}, - {"Big5", "big5", my_cs_exact}, - {"cp1251", "cp1251", my_cs_exact}, - {"cp1255", "hebrew", my_cs_approx}, - {"CP866", "cp866", my_cs_exact}, - {"eucCN", "gb2312", my_cs_exact}, - {"euc-CN", "gb2312", my_cs_exact}, - {"eucJP", "ujis", my_cs_exact}, - {"euc-JP", "ujis", my_cs_exact}, - {"eucKR", "euckr", my_cs_exact}, - {"euc-KR", "euckr", my_cs_exact}, -#ifdef UNCOMMENT_THIS_WHEN_WL_WL_4024_IS_DONE - {"gb18030", "gb18030", my_cs_exact}, -#endif - {"gb2312", "gb2312", my_cs_exact}, - {"gbk", "gbk", my_cs_exact}, - {"georgianps", "geostd8", my_cs_exact}, - {"georgian-ps", "geostd8", my_cs_exact}, - {"IBM-1252", "cp1252", my_cs_exact}, - - {"iso88591", "latin1", my_cs_approx}, - {"ISO_8859-1", "latin1", my_cs_approx}, - {"ISO8859-1", "latin1", my_cs_approx}, - {"ISO-8859-1", "latin1", my_cs_approx}, - - {"iso885913", "latin7", my_cs_exact}, - {"ISO_8859-13", "latin7", my_cs_exact}, - {"ISO8859-13", "latin7", my_cs_exact}, - {"ISO-8859-13", "latin7", my_cs_exact}, - -#ifdef UNCOMMENT_THIS_WHEN_WL_4579_IS_DONE - {"iso885915", "latin9", my_cs_exact}, - {"ISO_8859-15", "latin9", my_cs_exact}, - {"ISO8859-15", "latin9", my_cs_exact}, - {"ISO-8859-15", "latin9", my_cs_exact}, -#endif - - {"iso88592", "latin2", my_cs_exact}, - {"ISO_8859-2", "latin2", my_cs_exact}, - {"ISO8859-2", "latin2", my_cs_exact}, - {"ISO-8859-2", "latin2", my_cs_exact}, - - {"iso88597", "greek", my_cs_exact}, - {"ISO_8859-7", "greek", my_cs_exact}, - {"ISO8859-7", "greek", my_cs_exact}, - {"ISO-8859-7", "greek", my_cs_exact}, - - {"iso88598", "hebrew", my_cs_exact}, - {"ISO_8859-8", "hebrew", my_cs_exact}, - {"ISO8859-8", "hebrew", my_cs_exact}, - {"ISO-8859-8", "hebrew", my_cs_exact}, - - {"iso88599", "latin5", my_cs_exact}, - {"ISO_8859-9", "latin5", my_cs_exact}, - {"ISO8859-9", "latin5", my_cs_exact}, - {"ISO-8859-9", "latin5", my_cs_exact}, - - {"koi8r", "koi8r", my_cs_exact}, - {"KOI8-R", "koi8r", my_cs_exact}, - {"koi8u", "koi8u", my_cs_exact}, - {"KOI8-U", "koi8u", my_cs_exact}, - - {"roman8", "hp8", my_cs_exact}, /* Default on HP UX */ - - {"Shift_JIS", "sjis", my_cs_exact}, - {"SJIS", "sjis", my_cs_exact}, - {"shiftjisx0213", "sjis", my_cs_exact}, - - {"tis620", "tis620", my_cs_exact}, - {"tis-620", "tis620", my_cs_exact}, - - {"ujis", "ujis", my_cs_exact}, - - {"US-ASCII", "latin1", my_cs_approx}, - - {"utf8", "utf8", my_cs_exact}, - {"utf-8", "utf8", my_cs_exact}, -#endif - {NULL, NULL, 0} -}; - - -static const char * -my_os_charset_to_mysql_charset(const char *csname) -{ - const MY_CSET_OS_NAME *csp; - for (csp= charsets; csp->os_name; csp++) - { - if (!my_strcasecmp(&my_charset_latin1, csp->os_name, csname)) - { - switch (csp->param) - { - case my_cs_exact: - return csp->my_name; - - case my_cs_approx: - /* - Maybe we should print a warning eventually: - character set correspondence is not exact. - */ - return csp->my_name; - - default: - my_printf_error(ER_UNKNOWN_ERROR, - "OS character set '%s'" - " is not supported by MySQL client", - MYF(0), csp->my_name); - goto def; - } - } - } - - my_printf_error(ER_UNKNOWN_ERROR, - "Unknown OS character set '%s'.", - MYF(0), csname); - -def: - csname= MYSQL_DEFAULT_CHARSET_NAME; - my_printf_error(ER_UNKNOWN_ERROR, - "Switching to the default character set '%s'.", - MYF(0), csname); - return csname; -} - - -#ifndef _WIN32 -#include <stdlib.h> /* for getenv() */ -#ifdef HAVE_LANGINFO_H -#include <langinfo.h> -#endif -#ifdef HAVE_LOCALE_H -#include <locale.h> -#endif -#endif /* _WIN32 */ - - +#include <my_sys.h> static int mysql_autodetect_character_set(MYSQL *mysql) { - const char *csname= MYSQL_DEFAULT_CHARSET_NAME; - -#ifdef _WIN32 - char cpbuf[64]; - { - UINT cp= GetConsoleCP(); - if (cp == 0) - cp= GetACP(); - my_snprintf(cpbuf, sizeof(cpbuf), "cp%d", (int)cp); - csname= my_os_charset_to_mysql_charset(cpbuf); - } -#elif defined(HAVE_SETLOCALE) && defined(HAVE_NL_LANGINFO) - { - if (setlocale(LC_CTYPE, "") && (csname= nl_langinfo(CODESET))) - csname= my_os_charset_to_mysql_charset(csname); - } -#endif - if (mysql->options.charset_name) my_free(mysql->options.charset_name); - if (!(mysql->options.charset_name= my_strdup(csname, MYF(MY_WME)))) + if (!(mysql->options.charset_name= my_strdup(my_default_csname(),MYF(MY_WME)))) return 1; return 0; } @@ -1944,16 +1707,13 @@ C_MODE_START int mysql_init_character_set(MYSQL *mysql) { /* Set character set */ - if (!mysql->options.charset_name) + if (!mysql->options.charset_name || + !strcmp(mysql->options.charset_name, + MYSQL_AUTODETECT_CHARSET_NAME)) { - if (!(mysql->options.charset_name= - my_strdup(MYSQL_DEFAULT_CHARSET_NAME,MYF(MY_WME)))) + if (mysql_autodetect_character_set(mysql)) return 1; } - else if (!strcmp(mysql->options.charset_name, - MYSQL_AUTODETECT_CHARSET_NAME) && - mysql_autodetect_character_set(mysql)) - return 1; mysql_set_character_set_with_default_collation(mysql); diff --git a/sql/field.cc b/sql/field.cc index 990d86a545e..3cff08d1e7c 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -10935,20 +10935,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), + "<data type> <character set clause> ... COMPRESSED...", + "'<data type> COMPRESSED... <character set clause> ...'"); + 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 2ce9b974a50..aaa322fdd11 100644 --- a/sql/field.h +++ b/sql/field.h @@ -4986,6 +4986,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/item_timefunc.cc b/sql/item_timefunc.cc index 81d5bfed981..2c527154108 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -1933,7 +1933,7 @@ bool Item_func_from_unixtime::get_date(THD *thd, MYSQL_TIME *ltime, ltime->time_type= MYSQL_TIMESTAMP_TIME; VSec9 sec(thd, args[0], "unixtime", TIMESTAMP_MAX_VALUE); - DBUG_ASSERT(sec.sec() <= TIMESTAMP_MAX_VALUE); + DBUG_ASSERT(sec.is_null() || sec.sec() <= TIMESTAMP_MAX_VALUE); if (sec.is_null() || sec.truncated() || sec.neg()) return (null_value= 1); @@ -2601,8 +2601,8 @@ bool Item_func_maketime::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzy return (null_value= 1); int warn; - new(ltime) Time(&warn, hour.neg(), hour.abs(), (uint) minute, sec, - thd->temporal_round_mode(), decimals); + new(ltime) Time(&warn, hour.neg(), hour.abs(), (uint) minute, + sec.to_const_sec9(), thd->temporal_round_mode(), decimals); if (warn) { // use check_time_range() to set ltime to the max value depending on dec diff --git a/sql/records.cc b/sql/records.cc index 5dd4318b105..3d709182a4e 100644 --- a/sql/records.cc +++ b/sql/records.cc @@ -195,8 +195,7 @@ bool init_read_record(READ_RECORD *info,THD *thd, TABLE *table, info->table=table; info->addon_field= addon_field; - if ((table->s->tmp_table == INTERNAL_TMP_TABLE || - table->s->tmp_table == NON_TRANSACTIONAL_TMP_TABLE) && + if ((table->s->tmp_table == INTERNAL_TMP_TABLE) && !addon_field) (void) table->file->extra(HA_EXTRA_MMAP); diff --git a/sql/set_var.cc b/sql/set_var.cc index 9ca6e4bb575..f81e2753ac1 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -808,7 +808,7 @@ int set_var::light_check(THD *thd) if (var->check_type(type)) { int err= type == OPT_GLOBAL ? ER_LOCAL_VARIABLE : ER_GLOBAL_VARIABLE; - my_error(err, MYF(0), var->name); + my_error(err, MYF(0), var->name.str); return -1; } if (type == OPT_GLOBAL && check_global_access(thd, SUPER_ACL)) diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index f214901327b..0fb357fd105 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -5084,7 +5084,6 @@ GRANT_NAME::GRANT_NAME(TABLE *form, bool is_routine) update_hostname(&host, hostname); db= get_field(&grant_memroot,form->field[1]); - sort= get_magic_sort("hdu", host.hostname, db, user); tname= get_field(&grant_memroot,form->field[3]); if (!db || !tname) { @@ -5092,6 +5091,7 @@ GRANT_NAME::GRANT_NAME(TABLE *form, bool is_routine) privs= 0; return; /* purecov: inspected */ } + sort= get_magic_sort("hdu", host.hostname, db, user); if (lower_case_table_names) { my_casedn_str(files_charset_info, db); diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc index d004bcd974a..5dcb7ffac72 100644 --- a/sql/sql_admin.cc +++ b/sql/sql_admin.cc @@ -700,19 +700,23 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, MDL_SHARED_NO_READ_WRITE lock (MDL_SHARED_WRITE cannot be upgraded) by *not* having HA_CONCURRENT_OPTIMIZE table_flag. */ - if (lock_type == TL_WRITE && !table->table->s->tmp_table && - table->mdl_request.type > MDL_SHARED_WRITE) + if (lock_type == TL_WRITE && table->mdl_request.type > MDL_SHARED_WRITE) { - if (wait_while_table_is_used(thd, table->table, HA_EXTRA_NOT_USED)) - goto err; - DEBUG_SYNC(thd, "after_admin_flush"); - /* Flush entries in the query cache involving this table. */ - query_cache_invalidate3(thd, table->table, 0); - /* - XXX: hack: switch off open_for_modify to skip the - flush that is made later in the execution flow. - */ - open_for_modify= 0; + if (table->table->s->tmp_table) + thd->close_unused_temporary_table_instances(tables); + else + { + if (wait_while_table_is_used(thd, table->table, HA_EXTRA_NOT_USED)) + goto err; + DEBUG_SYNC(thd, "after_admin_flush"); + /* Flush entries in the query cache involving this table. */ + query_cache_invalidate3(thd, table->table, 0); + /* + XXX: hack: switch off open_for_modify to skip the + flush that is made later in the execution flow. + */ + open_for_modify= 0; + } } if (table->table->s->crashed && operator_func == &handler::ha_check) diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index 36a879fc5cd..12119997430 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -681,7 +681,7 @@ mysql_ha_fix_cond_and_key(SQL_HANDLER *handler, HA_ONLY_WHOLE_INDEX)) { my_error(ER_KEY_DOESNT_SUPPORT, MYF(0), - table->file->index_type(handler->keyno), keyinfo->name); + table->file->index_type(handler->keyno), keyinfo->name.str); return 1; } diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 1c0c0301e7d..1c482446866 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1790,12 +1790,15 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) } if (table->vfield) { + my_bool abort_on_warning= thd->abort_on_warning; /* We have not yet called update_virtual_fields(VOL_UPDATE_FOR_READ) in handler methods for the just read row in record[1]. */ table->move_fields(table->field, table->record[1], table->record[0]); + thd->abort_on_warning= 0; table->update_virtual_fields(table->file, VCOL_UPDATE_FOR_REPLACE); + thd->abort_on_warning= abort_on_warning; table->move_fields(table->field, table->record[0], table->record[1]); } if (info->handle_duplicates == DUP_UPDATE) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 770791a67e4..54a41adbf68 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -794,8 +794,6 @@ void init_update_queries(void) Note that SQLCOM_RENAME_TABLE should not be in this list! */ sql_command_flags[SQLCOM_CREATE_TABLE]|= CF_PREOPEN_TMP_TABLES; - sql_command_flags[SQLCOM_DROP_TABLE]|= CF_PREOPEN_TMP_TABLES; - sql_command_flags[SQLCOM_DROP_SEQUENCE]|= CF_PREOPEN_TMP_TABLES; sql_command_flags[SQLCOM_CREATE_INDEX]|= CF_PREOPEN_TMP_TABLES; sql_command_flags[SQLCOM_ALTER_TABLE]|= CF_PREOPEN_TMP_TABLES; sql_command_flags[SQLCOM_TRUNCATE]|= CF_PREOPEN_TMP_TABLES; @@ -4799,7 +4797,14 @@ mysql_execute_command(THD *thd) case SQLCOM_DROP_SEQUENCE: case SQLCOM_DROP_TABLE: { + int result; DBUG_ASSERT(first_table == all_tables && first_table != 0); + + thd->open_options|= HA_OPEN_FOR_REPAIR; + result= thd->open_temporary_tables(all_tables); + thd->open_options&= ~HA_OPEN_FOR_REPAIR; + if (result) + goto error; if (!lex->tmp_table()) { if (check_table_access(thd, DROP_ACL, all_tables, FALSE, UINT_MAX, FALSE)) diff --git a/sql/sql_table.cc b/sql/sql_table.cc index c47f85aaf4c..28c0f015c82 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -10098,6 +10098,8 @@ do_continue:; DEBUG_SYNC(thd, "alter_table_copy_after_lock_upgrade"); } + else + thd->close_unused_temporary_table_instances(table_list); // It's now safe to take the table level lock. if (lock_tables(thd, table_list, alter_ctx.tables_opened, diff --git a/sql/sql_type.h b/sql/sql_type.h index 0376cd84443..aaf42558fa3 100644 --- a/sql/sql_type.h +++ b/sql/sql_type.h @@ -533,12 +533,42 @@ public: }; -class VSec9: public Sec9 +class VSec9: protected Sec9 { bool m_is_null; + Sec9& to_sec9() + { + DBUG_ASSERT(!is_null()); + return *this; + } public: VSec9(THD *thd, Item *item, const char *type_str, ulonglong limit); bool is_null() const { return m_is_null; } + const Sec9& to_const_sec9() const + { + DBUG_ASSERT(!is_null()); + return *this; + } + bool neg() const { return to_const_sec9().neg(); } + bool truncated() const { return to_const_sec9().truncated(); } + ulonglong sec() const { return to_const_sec9().sec(); } + long usec() const { return to_const_sec9().usec(); } + bool sec_to_time(MYSQL_TIME *ltime, uint dec) const + { + return to_const_sec9().sec_to_time(ltime, dec); + } + void make_truncated_warning(THD *thd, const char *type_str) const + { + return to_const_sec9().make_truncated_warning(thd, type_str); + } + Sec9 &round(uint dec) + { + return to_sec9().round(dec); + } + Sec9 &round(uint dec, time_round_mode_t mode) + { + return to_sec9().round(dec, mode); + } }; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 374e7bae1ab..d50f9722d7e 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2075,7 +2075,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 @@ -6693,7 +6696,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; @@ -6882,6 +6888,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 { @@ -6897,25 +6910,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); @@ -6981,17 +6994,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); @@ -7007,36 +7020,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_json_longtext); @@ -7152,13 +7165,9 @@ opt_precision: | precision { $$= $1; } ; -opt_attribute: - /* empty */ {} - | opt_attribute_list {} - ; -opt_attribute_list: - opt_attribute_list attribute {} +attribute_list: + attribute_list attribute {} | attribute ; @@ -7186,11 +7195,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 ; @@ -7199,6 +7203,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 { @@ -7357,7 +7391,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); } @@ -15731,6 +15769,7 @@ keyword_sp_var_not_label: | COLUMN_DELETE_SYM | COLUMN_GET_SYM | COMMENT_SYM + | COMPRESSED_SYM | DEALLOCATE_SYM | EXAMINED_SYM | EXCLUDE_SYM @@ -15944,7 +15983,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 93144658bca..75c57111dc5 100644 --- a/sql/sql_yacc_ora.yy +++ b/sql/sql_yacc_ora.yy @@ -295,10 +295,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); %parse-param { THD *thd } %lex-param { THD *thd } /* - Currently there are 48 shift/reduce conflicts. + Currently there are 50 shift/reduce conflicts. We should not introduce new conflicts any more. */ -%expect 48 +%expect 50 /* Comments for TOKENS. @@ -1550,7 +1550,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 @@ -6692,7 +6695,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; @@ -6891,6 +6897,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 { @@ -6906,25 +6919,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); @@ -7032,17 +7045,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); @@ -7058,36 +7071,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_json_longtext); @@ -7230,13 +7243,9 @@ opt_precision: | precision { $$= $1; } ; -opt_attribute: - /* empty */ {} - | opt_attribute_list {} - ; -opt_attribute_list: - opt_attribute_list attribute {} +attribute_list: + attribute_list attribute {} | attribute ; @@ -7264,11 +7273,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 ; @@ -7277,6 +7281,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 { @@ -7448,7 +7482,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); } @@ -15827,6 +15865,7 @@ keyword_label: | keyword_sp_var_and_label | keyword_sysvar_type | FUNCTION_SYM + | COMPRESSED_SYM ; keyword_sysvar_name: @@ -15896,6 +15935,7 @@ keyword_sp_var_not_label: | COLUMN_DELETE_SYM | COLUMN_GET_SYM | COMMENT_SYM + | COMPRESSED_SYM | DEALLOCATE_SYM | EXAMINED_SYM | EXCLUDE_SYM @@ -16109,7 +16149,6 @@ keyword_sp_var_and_label: | COMMITTED_SYM | COMPACT_SYM | COMPLETION_SYM - | COMPRESSED_SYM | CONCURRENT | CONNECTION_SYM | CONSISTENT_SYM diff --git a/sql/temporary_tables.cc b/sql/temporary_tables.cc index eca5dd2a7d5..c42b6138c28 100644 --- a/sql/temporary_tables.cc +++ b/sql/temporary_tables.cc @@ -390,6 +390,9 @@ bool THD::open_temporary_table(TABLE_LIST *tl) rgi_slave->is_parallel_exec && wait_for_prior_commit()) DBUG_RETURN(true); + + if (!table && is_error()) + DBUG_RETURN(true); // Error when opening table } if (!table) diff --git a/sql/wsrep_trans_observer.h b/sql/wsrep_trans_observer.h index e6901f15ca7..64ac80783c9 100644 --- a/sql/wsrep_trans_observer.h +++ b/sql/wsrep_trans_observer.h @@ -193,6 +193,8 @@ static inline bool wsrep_run_commit_hook(THD* thd, bool all) wsrep_is_ordered(thd))); /* Is MST commit or autocommit? */ bool ret= wsrep_is_active(thd) && wsrep_is_real(thd, all); + /* Do not commit if we are aborting */ + ret= ret && (thd->wsrep_trx().state() != wsrep::transaction::s_aborting); if (ret && !(wsrep_has_changes(thd) || /* Has generated write set */ /* Is high priority (replay, applier, storage) and the transaction is scheduled for commit ordering */ diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 619ee0a403b..39d97f8f8af 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -7827,7 +7827,7 @@ dup_fk: Sql_condition::WARN_LEVEL_WARN, HA_ERR_WRONG_INDEX, "InnoDB could not find key" - " with name %s", key->name); + " with name %s", key->name.str); } else { ut_ad(!index->to_be_dropped); if (!index->is_primary()) { diff --git a/storage/innobase/include/dyn0buf.h b/storage/innobase/include/dyn0buf.h index 1d624d887d5..db809c908ae 100644 --- a/storage/innobase/include/dyn0buf.h +++ b/storage/innobase/include/dyn0buf.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2013, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2018, MariaDB Corporation. +Copyright (c) 2018, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -359,6 +359,24 @@ public: } /** + Iterate over all the blocks in reverse and call the iterator + @return false if iteration was terminated. */ + template <typename Functor> + bool for_each_block_in_reverse(const Functor& functor) const + { + for (block_t* block = UT_LIST_GET_LAST(m_list); + block != NULL; + block = UT_LIST_GET_PREV(m_node, block)) { + + if (!functor(block)) { + return(false); + } + } + + return(true); + } + + /** @return the first block */ block_t* front() MY_ATTRIBUTE((warn_unused_result)) diff --git a/storage/innobase/include/mtr0mtr.h b/storage/innobase/include/mtr0mtr.h index 55b0b4b82d1..4b41506d339 100644 --- a/storage/innobase/include/mtr0mtr.h +++ b/storage/innobase/include/mtr0mtr.h @@ -525,7 +525,7 @@ struct mtr_t { /** Check if this mini-transaction is dirtying a clean page. @param block block being x-fixed @return true if the mtr is dirtying a clean page. */ - static bool is_block_dirtied(const buf_block_t* block) + static inline bool is_block_dirtied(const buf_block_t* block) MY_ATTRIBUTE((warn_unused_result)); private: diff --git a/storage/innobase/include/mtr0mtr.ic b/storage/innobase/include/mtr0mtr.ic index 96e906fffb2..9a83badc173 100644 --- a/storage/innobase/include/mtr0mtr.ic +++ b/storage/innobase/include/mtr0mtr.ic @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -26,6 +26,20 @@ Created 11/26/1995 Heikki Tuuri #include "buf0buf.h" +/** Check if a mini-transaction is dirtying a clean page. +@return true if the mtr is dirtying a clean page. */ +bool +mtr_t::is_block_dirtied(const buf_block_t* block) +{ + ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE); + ut_ad(block->page.buf_fix_count > 0); + + /* It is OK to read oldest_modification because no + other thread can be performing a write of it and it + is only during write that the value is reset to 0. */ + return(block->page.oldest_modification == 0); +} + /** Pushes an object to an mtr memo stack. */ void diff --git a/storage/innobase/include/mtr0types.h b/storage/innobase/include/mtr0types.h index 6fa0d30bcb7..1a4fd590f6e 100644 --- a/storage/innobase/include/mtr0types.h +++ b/storage/innobase/include/mtr0types.h @@ -38,7 +38,9 @@ enum mtr_log_t { /** Default mode: log all operations modifying disk-based data */ MTR_LOG_ALL = 21, - /** Log no operations and dirty pages are not added to the flush list */ + /** Log no operations and dirty pages are not added to the flush list. + Set when applying log in crash recovery or when a modification of a + ROW_FORMAT=COMPRESSED page is attempted. */ MTR_LOG_NONE = 22, /** Don't generate REDO log but add dirty pages to flush list */ diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc index bbda0270b9b..75e6b500c07 100644 --- a/storage/innobase/mtr/mtr0mtr.cc +++ b/storage/innobase/mtr/mtr0mtr.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2018, MariaDB Corporation. +Copyright (c) 2017, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -37,16 +37,43 @@ Created 11/26/1995 Heikki Tuuri /** Iterate over a memo block in reverse. */ template <typename Functor> -struct Iterate { +struct CIterate { + CIterate() : functor() {} - /** Release specific object */ - explicit Iterate(Functor& functor) - : - m_functor(functor) + CIterate(const Functor& functor) : functor(functor) {} + + /** @return false if the functor returns false. */ + bool operator()(mtr_buf_t::block_t* block) const { - /* Do nothing */ + const mtr_memo_slot_t* start = + reinterpret_cast<const mtr_memo_slot_t*>( + block->begin()); + + mtr_memo_slot_t* slot = + reinterpret_cast<mtr_memo_slot_t*>( + block->end()); + + ut_ad(!(block->used() % sizeof(*slot))); + + while (slot-- != start) { + + if (!functor(slot)) { + return(false); + } + } + + return(true); } + Functor functor; +}; + +template <typename Functor> +struct Iterate { + Iterate() : functor() {} + + Iterate(const Functor& functor) : functor(functor) {} + /** @return false if the functor returns false. */ bool operator()(mtr_buf_t::block_t* block) { @@ -62,7 +89,7 @@ struct Iterate { while (slot-- != start) { - if (!m_functor(slot)) { + if (!functor(slot)) { return(false); } } @@ -70,7 +97,7 @@ struct Iterate { return(true); } - Functor& m_functor; + Functor functor; }; /** Find specific object */ @@ -430,20 +457,6 @@ private: lsn_t m_end_lsn; }; -/** Check if a mini-transaction is dirtying a clean page. -@return true if the mtr is dirtying a clean page. */ -bool -mtr_t::is_block_dirtied(const buf_block_t* block) -{ - ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE); - ut_ad(block->page.buf_fix_count > 0); - - /* It is OK to read oldest_modification because no - other thread can be performing a write of it and it - is only during write that the value is reset to 0. */ - return(block->page.oldest_modification == 0); -} - /** Write the block contents to the REDO log */ struct mtr_write_log_t { /** Append a block to the redo log buffer. @@ -509,12 +522,7 @@ mtr_t::Command::release_resources() /* Currently only used in commit */ ut_ad(m_impl->m_state == MTR_STATE_COMMITTING); -#ifdef UNIV_DEBUG - DebugCheck release; - Iterate<DebugCheck> iterator(release); - - m_impl->m_memo.for_each_block_in_reverse(iterator); -#endif /* UNIV_DEBUG */ + ut_d(m_impl->m_memo.for_each_block_in_reverse(CIterate<DebugCheck>())); /* Reset the mtr buffers */ m_impl->m_log.erase(); @@ -701,11 +709,10 @@ mtr_t::memo_release(const void* object, ulint type) middle of a mini-transaction. */ ut_ad(!m_impl.m_modifications || type != MTR_MEMO_PAGE_X_FIX); - Find find(object, type); - Iterate<Find> iterator(find); + Iterate<Find> iteration(Find(object, type)); - if (!m_impl.m_memo.for_each_block_in_reverse(iterator)) { - memo_slot_release(find.m_slot); + if (!m_impl.m_memo.for_each_block_in_reverse(iteration)) { + memo_slot_release(iteration.functor.m_slot); return(true); } @@ -725,11 +732,10 @@ mtr_t::release_page(const void* ptr, mtr_memo_type_t type) middle of a mini-transaction. */ ut_ad(!m_impl.m_modifications || type != MTR_MEMO_PAGE_X_FIX); - FindPage find(ptr, type); - Iterate<FindPage> iterator(find); + Iterate<FindPage> iteration(FindPage(ptr, type)); - if (!m_impl.m_memo.for_each_block_in_reverse(iterator)) { - memo_slot_release(find.get_slot()); + if (!m_impl.m_memo.for_each_block_in_reverse(iteration)) { + memo_slot_release(iteration.functor.get_slot()); return; } @@ -853,10 +859,7 @@ mtr_t::Command::finish_write( void mtr_t::Command::release_all() { - ReleaseAll release; - Iterate<ReleaseAll> iterator(release); - - m_impl->m_memo.for_each_block_in_reverse(iterator); + m_impl->m_memo.for_each_block_in_reverse(CIterate<ReleaseAll>()); /* Note that we have released the latches. */ m_locks_released = 1; @@ -866,10 +869,7 @@ mtr_t::Command::release_all() void mtr_t::Command::release_latches() { - ReleaseLatches release; - Iterate<ReleaseLatches> iterator(release); - - m_impl->m_memo.for_each_block_in_reverse(iterator); + m_impl->m_memo.for_each_block_in_reverse(CIterate<ReleaseLatches>()); /* Note that we have released the latches. */ m_locks_released = 1; @@ -879,10 +879,10 @@ mtr_t::Command::release_latches() void mtr_t::Command::release_blocks() { - ReleaseBlocks release(m_start_lsn, m_end_lsn, m_impl->m_flush_observer); - Iterate<ReleaseBlocks> iterator(release); - - m_impl->m_memo.for_each_block_in_reverse(iterator); + m_impl->m_memo.for_each_block_in_reverse( + CIterate<const ReleaseBlocks>( + ReleaseBlocks(m_start_lsn, m_end_lsn, + m_impl->m_flush_observer))); } /** Write the redo log record, add dirty pages to the flush list and release @@ -927,10 +927,8 @@ mtr_t::memo_contains( const void* object, ulint type) { - Find find(object, type); - Iterate<Find> iterator(find); - - if (memo->for_each_block_in_reverse(iterator)) { + Iterate<Find> iteration(Find(object, type)); + if (memo->for_each_block_in_reverse(iteration)) { return(false); } @@ -1019,10 +1017,8 @@ mtr_t::memo_contains_flagged(const void* ptr, ulint flags) const ut_ad(m_impl.m_magic_n == MTR_MAGIC_N); ut_ad(is_committing() || is_active()); - FlaggedCheck check(ptr, flags); - Iterate<FlaggedCheck> iterator(check); - - return(!m_impl.m_memo.for_each_block_in_reverse(iterator)); + return !m_impl.m_memo.for_each_block_in_reverse( + CIterate<FlaggedCheck>(FlaggedCheck(ptr, flags))); } /** Check if memo contains the given page. @@ -1036,11 +1032,9 @@ mtr_t::memo_contains_page_flagged( const byte* ptr, ulint flags) const { - FindPage check(ptr, flags); - Iterate<FindPage> iterator(check); - - return(m_impl.m_memo.for_each_block_in_reverse(iterator) - ? NULL : check.get_block()); + Iterate<FindPage> iteration(FindPage(ptr, flags)); + return m_impl.m_memo.for_each_block_in_reverse(iteration) + ? NULL : iteration.functor.get_block(); } /** Mark the given latched page as modified. diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index 89a1f4fdcf4..dc7d9586949 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -1253,6 +1253,7 @@ int ha_maria::check(THD * thd, HA_CHECK_OPT * check_opt) if (!file || !param) return HA_ADMIN_INTERNAL_ERROR; + unmap_file(file); maria_chk_init(param); param->thd= thd; param->op_name= "check"; @@ -1486,6 +1487,7 @@ int ha_maria::zerofill(THD * thd, HA_CHECK_OPT *check_opt) if (!file || !param) return HA_ADMIN_INTERNAL_ERROR; + unmap_file(file); old_trn= file->trn; maria_chk_init(param); param->thd= thd; @@ -1584,6 +1586,7 @@ int ha_maria::repair(THD *thd, HA_CHECK *param, bool do_optimize) param->out_flag= 0; share->state.dupp_key= MI_MAX_KEY; strmov(fixed_name, share->open_file_name.str); + unmap_file(file); /* Don't lock tables if we have used LOCK TABLE or if we come from @@ -1763,7 +1766,6 @@ int ha_maria::assign_to_keycache(THD * thd, HA_CHECK_OPT *check_opt) TABLE_LIST *table_list= table->pos_in_table_list; DBUG_ENTER("ha_maria::assign_to_keycache"); - table->keys_in_use_for_query.clear_all(); if (table_list->process_index_hints(table)) @@ -2738,7 +2740,8 @@ int ha_maria::external_lock(THD *thd, int lock_type) } else { - TRN *trn= (file->trn != &dummy_transaction_object ? file->trn : 0); + /* We have to test for THD_TRN to protect against implicit commits */ + TRN *trn= (file->trn != &dummy_transaction_object && THD_TRN ? file->trn : 0); /* End of transaction */ /* diff --git a/storage/maria/ma_blockrec.c b/storage/maria/ma_blockrec.c index b5812a98180..8873f191cb0 100644 --- a/storage/maria/ma_blockrec.c +++ b/storage/maria/ma_blockrec.c @@ -5248,6 +5248,8 @@ my_bool _ma_scan_init_block_record(MARIA_HA *info) { MARIA_SHARE *share= info->s; DBUG_ENTER("_ma_scan_init_block_record"); + DBUG_ASSERT(info->dfile.file == share->bitmap.file.file); + /* bitmap_buff may already be allocated if this is the second call to rnd_init() without a rnd_end() in between, see sql/handler.h diff --git a/storage/maria/ma_close.c b/storage/maria/ma_close.c index 8528e8a35f3..b345315013b 100644 --- a/storage/maria/ma_close.c +++ b/storage/maria/ma_close.c @@ -116,10 +116,7 @@ int maria_close(register MARIA_HA *info) if (flush_pagecache_blocks(share->pagecache, &share->kfile, share->deleting ? FLUSH_IGNORE_CHANGED : FLUSH_RELEASE)) error= my_errno; -#ifdef HAVE_MMAP - if (share->file_map) - _ma_unmap_file(info); -#endif + unmap_file(info); if (((share->changed && share->base.born_transactional) || maria_is_crashed(info) || (share->temporary && !share->deleting))) { diff --git a/storage/maria/ma_delete_all.c b/storage/maria/ma_delete_all.c index 1daf5f3ef80..c1019c01c66 100644 --- a/storage/maria/ma_delete_all.c +++ b/storage/maria/ma_delete_all.c @@ -38,6 +38,9 @@ int maria_delete_all_rows(MARIA_HA *info) MARIA_SHARE *share= info->s; my_bool log_record; LSN lsn; +#ifdef HAVE_MMAP + my_bool mmap_file= share->file_map != 0; +#endif DBUG_ENTER("maria_delete_all_rows"); if (share->options & HA_OPTION_READ_ONLY_DATA) @@ -95,7 +98,7 @@ int maria_delete_all_rows(MARIA_HA *info) */ #ifdef HAVE_MMAP - if (share->file_map) + if (mmap_file) _ma_unmap_file(info); #endif @@ -141,7 +144,7 @@ int maria_delete_all_rows(MARIA_HA *info) _ma_writeinfo(info, WRITEINFO_UPDATE_KEYFILE); #ifdef HAVE_MMAP /* Map again */ - if (share->file_map) + if (mmap_file) _ma_dynmap_file(info, (my_off_t) 0); #endif DBUG_RETURN(0); diff --git a/storage/maria/ma_packrec.c b/storage/maria/ma_packrec.c index 27c5538e51b..e2c1e353616 100644 --- a/storage/maria/ma_packrec.c +++ b/storage/maria/ma_packrec.c @@ -1564,8 +1564,13 @@ my_bool _ma_memmap_file(MARIA_HA *info) void _ma_unmap_file(MARIA_HA *info) { - my_munmap((char*) info->s->file_map, - (size_t) info->s->mmaped_length + MEMMAP_EXTRA_MARGIN); + MARIA_SHARE *share= info->s; + my_munmap((char*) share->file_map, + (size_t) share->mmaped_length + MEMMAP_EXTRA_MARGIN); + share->file_map= 0; + share->file_read= _ma_nommap_pread; + share->file_write= _ma_nommap_pwrite; + info->opt_flag&= ~MEMMAP_USED; } diff --git a/storage/maria/ma_pagecache.c b/storage/maria/ma_pagecache.c index d12ae54b52f..7bd85b7db02 100644 --- a/storage/maria/ma_pagecache.c +++ b/storage/maria/ma_pagecache.c @@ -3776,8 +3776,6 @@ restart: pagecache_pthread_mutex_lock(&pagecache->cache_lock); #endif } - if (status & PCBLOCK_ERROR) - my_errno= block->error; } remove_reader(block); @@ -3809,6 +3807,7 @@ restart: if (status & PCBLOCK_ERROR) { + my_errno= block->error; DBUG_ASSERT(my_errno != 0); DBUG_PRINT("error", ("Got error %d when doing page read", my_errno)); DBUG_RETURN((uchar *) 0); diff --git a/storage/maria/ma_test1.c b/storage/maria/ma_test1.c index 2b3012faa5f..3a7981c81b4 100644 --- a/storage/maria/ma_test1.c +++ b/storage/maria/ma_test1.c @@ -292,6 +292,11 @@ static int run_test(const char *filename) if (!silent) printf("- Updating rows\n"); + create_key(key, j); + if ((maria_rkey(file, read_record, 0, key, + HA_WHOLE_KEY, HA_READ_KEY_EXACT))) + printf("Can't find last written row with maria_rkey\n"); + /* Update first last row to force extend of file */ if (maria_rsame(file,read_record,-1)) { diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h index 21d70cf5c58..56718731b45 100644 --- a/storage/maria/maria_def.h +++ b/storage/maria/maria_def.h @@ -1451,3 +1451,11 @@ extern my_bool ma_yield_and_check_if_killed(MARIA_HA *info, int inx); extern my_bool ma_killed_standalone(MARIA_HA *); extern uint _ma_file_callback_to_id(void *callback_data); + +static inline void unmap_file(MARIA_HA *info __attribute__((unused))) +{ +#ifdef HAVE_MMAP + if (info->s->file_map) + _ma_unmap_file(info); +#endif +} diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc index 674489c340a..a7802e5e473 100644 --- a/storage/rocksdb/ha_rocksdb.cc +++ b/storage/rocksdb/ha_rocksdb.cc @@ -11033,6 +11033,41 @@ void ha_rocksdb::read_thd_vars(THD *const thd) { m_checksums_pct = THDVAR(thd, checksums_pct); } +ulonglong ha_rocksdb::table_flags() const +{ + DBUG_ENTER_FUNC(); + + /* + HA_BINLOG_STMT_CAPABLE + Upstream: MyRocks advertises itself as it supports SBR, but has additional + checks in ha_rocksdb::external_lock()/ start_stmt() which will return an + error if one tries to run the statement. + Exceptions: @@rocksdb_unsafe_for_binlog or we are an SQL slave thread. + + MariaDB: Inform the upper layer we don't support SBR, so it switches to RBR + if possible. The exceptions are the same as with the upstream. + + HA_REC_NOT_IN_SEQ + If we don't set it, filesort crashes, because it assumes rowids are + 1..8 byte numbers + HA_PRIMARY_KEY_IN_READ_INDEX + This flag is always set, even for tables that: + - have no PK + - have some (or all) of PK that can't be decoded from the secondary + index. + */ + THD *thd= ha_thd(); + DBUG_RETURN(HA_BINLOG_ROW_CAPABLE | + ((thd && (THDVAR(thd, unsafe_for_binlog) ||thd->rgi_slave))? + HA_BINLOG_STMT_CAPABLE : 0) | + HA_REC_NOT_IN_SEQ | HA_CAN_INDEX_BLOBS | + HA_PRIMARY_KEY_IN_READ_INDEX | + HA_PRIMARY_KEY_REQUIRED_FOR_POSITION | HA_NULL_IN_KEY | + HA_PARTIAL_COLUMN_READ | + HA_TABLE_SCAN_ON_INDEX); +} + + /** @return @@ -11045,6 +11080,9 @@ int ha_rocksdb::external_lock(THD *const thd, int lock_type) { DBUG_ASSERT(thd != nullptr); int res = HA_EXIT_SUCCESS; +#if 0 + // MariaDB uses a different way to implement this, see ha_rocksdb::table_flags + int binlog_format = my_core::thd_binlog_format(thd); bool unsafe_for_binlog = THDVAR(ha_thd(), unsafe_for_binlog); @@ -11073,6 +11111,7 @@ int ha_rocksdb::external_lock(THD *const thd, int lock_type) { my_error(ER_REQUIRE_ROW_BINLOG_FORMAT, MYF(0)); DBUG_RETURN(HA_ERR_UNSUPPORTED); } +#endif if (lock_type == F_UNLCK) { Rdb_transaction *const tx = get_tx_from_thd(thd); @@ -11175,20 +11214,6 @@ int ha_rocksdb::external_lock(THD *const thd, int lock_type) { int ha_rocksdb::start_stmt(THD *const thd, thr_lock_type lock_type) { DBUG_ENTER_FUNC(); - /* - MariaDB: the following is a copy of the check in ha_rocksdb::external_lock: - */ - int binlog_format = my_core::thd_binlog_format(thd); - bool unsafe_for_binlog = THDVAR(ha_thd(), unsafe_for_binlog); - if (lock_type >= TL_WRITE_ALLOW_WRITE && - !thd->rgi_slave && !unsafe_for_binlog && - binlog_format != BINLOG_FORMAT_ROW && - binlog_format != BINLOG_FORMAT_UNSPEC && - my_core::thd_binlog_filter_ok(thd)) { - my_error(ER_REQUIRE_ROW_BINLOG_FORMAT, MYF(0)); - DBUG_RETURN(HA_ERR_UNSUPPORTED); - } - DBUG_ASSERT(thd != nullptr); Rdb_transaction *const tx = get_or_create_tx(thd); diff --git a/storage/rocksdb/ha_rocksdb.h b/storage/rocksdb/ha_rocksdb.h index 152ab3fa7c8..c5a0afef275 100644 --- a/storage/rocksdb/ha_rocksdb.h +++ b/storage/rocksdb/ha_rocksdb.h @@ -863,31 +863,7 @@ public: This is a list of flags that indicate what functionality the storage engine implements. The current table flags are documented in handler.h */ - ulonglong table_flags() const override { - DBUG_ENTER_FUNC(); - - /* - HA_BINLOG_STMT_CAPABLE - We are saying that this engine is just statement capable to have - an engine that can only handle statement-based logging. This is - used in testing. - HA_REC_NOT_IN_SEQ - If we don't set it, filesort crashes, because it assumes rowids are - 1..8 byte numbers - HA_PRIMARY_KEY_IN_READ_INDEX - This flag is always set, even for tables that: - - have no PK - - have some (or all) of PK that can't be decoded from the secondary - index. - */ - DBUG_RETURN(HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE | - HA_REC_NOT_IN_SEQ | HA_CAN_INDEX_BLOBS | - HA_PRIMARY_KEY_IN_READ_INDEX | - HA_PRIMARY_KEY_REQUIRED_FOR_POSITION | HA_NULL_IN_KEY | - HA_PARTIAL_COLUMN_READ | - HA_TABLE_SCAN_ON_INDEX); - } - + ulonglong table_flags() const override ; private: bool init_with_fields(); /* no 'override' in MariaDB */ public: diff --git a/storage/rocksdb/mysql-test/rocksdb/r/mariadb_misc_binlog.result b/storage/rocksdb/mysql-test/rocksdb/r/mariadb_misc_binlog.result index e4ac62aa481..c37ab9461af 100644 --- a/storage/rocksdb/mysql-test/rocksdb/r/mariadb_misc_binlog.result +++ b/storage/rocksdb/mysql-test/rocksdb/r/mariadb_misc_binlog.result @@ -18,7 +18,16 @@ set @tmp_bf= @@binlog_format; set binlog_format='STATEMENT'; lock tables t1 write; insert into t1 values(1); -ERROR HY000: Can't execute updates on master with binlog_format != ROW. +ERROR HY000: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. unlock tables; set @@binlog_format=@tmp_bf; drop table t1; +# +# MDEV-17045: MyRocks tables cannot be updated when binlog_format=MIXED. +# +set @tmp_bf= @@binlog_format; +set binlog_format='MIXED'; +create table t1 (pk int primary key) engine=rocksdb; +insert into t1 values (1); +drop table t1; +set @@binlog_format=@tmp_bf; diff --git a/storage/rocksdb/mysql-test/rocksdb/r/rpl_statement.result b/storage/rocksdb/mysql-test/rocksdb/r/rpl_statement.result index cdf0c37e339..df1a60519db 100644 --- a/storage/rocksdb/mysql-test/rocksdb/r/rpl_statement.result +++ b/storage/rocksdb/mysql-test/rocksdb/r/rpl_statement.result @@ -8,7 +8,7 @@ select @@binlog_format; STATEMENT create table t1 (pk int primary key) engine=rocksdb; insert into t1 values (1),(2),(3); -ERROR HY000: Can't execute updates on master with binlog_format != ROW. +ERROR HY000: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. set session rocksdb_unsafe_for_binlog=on; insert into t1 values (1),(2),(3); select * from t1; @@ -19,7 +19,7 @@ pk delete from t1; set session rocksdb_unsafe_for_binlog=off; insert into t1 values (1),(2),(3); -ERROR HY000: Can't execute updates on master with binlog_format != ROW. +ERROR HY000: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. set binlog_format=row; insert into t1 values (1),(2),(3); include/sync_slave_sql_with_master.inc diff --git a/storage/rocksdb/mysql-test/rocksdb/t/mariadb_misc_binlog.test b/storage/rocksdb/mysql-test/rocksdb/t/mariadb_misc_binlog.test index fb150f7a791..e32679e88a2 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/mariadb_misc_binlog.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/mariadb_misc_binlog.test @@ -21,10 +21,20 @@ unlock tables; set @tmp_bf= @@binlog_format; set binlog_format='STATEMENT'; lock tables t1 write; ---error ER_REQUIRE_ROW_BINLOG_FORMAT +--error ER_BINLOG_STMT_MODE_AND_ROW_ENGINE insert into t1 values(1); unlock tables; set @@binlog_format=@tmp_bf; drop table t1; +--echo # +--echo # MDEV-17045: MyRocks tables cannot be updated when binlog_format=MIXED. +--echo # +set @tmp_bf= @@binlog_format; +set binlog_format='MIXED'; +create table t1 (pk int primary key) engine=rocksdb; +insert into t1 values (1); +drop table t1; +set @@binlog_format=@tmp_bf; + diff --git a/storage/rocksdb/mysql-test/rocksdb/t/rpl_statement.test b/storage/rocksdb/mysql-test/rocksdb/t/rpl_statement.test index 29671308e9c..cb5f5e04b00 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/rpl_statement.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/rpl_statement.test @@ -12,7 +12,7 @@ connection master; select @@binlog_format; create table t1 (pk int primary key) engine=rocksdb; ---error ER_REQUIRE_ROW_BINLOG_FORMAT +--error ER_BINLOG_STMT_MODE_AND_ROW_ENGINE insert into t1 values (1),(2),(3); set session rocksdb_unsafe_for_binlog=on; @@ -21,7 +21,7 @@ select * from t1; delete from t1; set session rocksdb_unsafe_for_binlog=off; ---error ER_REQUIRE_ROW_BINLOG_FORMAT +--error ER_BINLOG_STMT_MODE_AND_ROW_ENGINE insert into t1 values (1),(2),(3); set binlog_format=row; |