summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/sys_vars/inc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:00:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:00:34 +0000
commit3f619478f796eddbba6e39502fe941b285dd97b1 (patch)
treee2c7b5777f728320e5b5542b6213fd3591ba51e2 /mysql-test/suite/sys_vars/inc
parentInitial commit. (diff)
downloadmariadb-3f619478f796eddbba6e39502fe941b285dd97b1.tar.xz
mariadb-3f619478f796eddbba6e39502fe941b285dd97b1.zip
Adding upstream version 1:10.11.6.upstream/1%10.11.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/suite/sys_vars/inc')
-rw-r--r--mysql-test/suite/sys_vars/inc/autocommit_func2.inc29
-rw-r--r--mysql-test/suite/sys_vars/inc/bin_relay_log_basename_index.inc55
-rw-r--r--mysql-test/suite/sys_vars/inc/charset_basic.inc81
-rw-r--r--mysql-test/suite/sys_vars/inc/collation_basic.inc260
-rw-r--r--mysql-test/suite/sys_vars/inc/explicit_defaults_for_timestamp.inc134
-rw-r--r--mysql-test/suite/sys_vars/inc/secure_timestamp_func.inc77
-rw-r--r--mysql-test/suite/sys_vars/inc/sysvar_global_and_session_grant.inc49
-rw-r--r--mysql-test/suite/sys_vars/inc/sysvar_global_grant.inc53
-rw-r--r--mysql-test/suite/sys_vars/inc/sysvar_global_grant_alone.inc41
-rw-r--r--mysql-test/suite/sys_vars/inc/sysvar_session_grant.inc51
-rw-r--r--mysql-test/suite/sys_vars/inc/sysvar_session_grant_alone.inc45
-rw-r--r--mysql-test/suite/sys_vars/inc/sysvars_server.inc39
-rw-r--r--mysql-test/suite/sys_vars/inc/sysvars_server.opt1
13 files changed, 915 insertions, 0 deletions
diff --git a/mysql-test/suite/sys_vars/inc/autocommit_func2.inc b/mysql-test/suite/sys_vars/inc/autocommit_func2.inc
new file mode 100644
index 00000000..5fff7215
--- /dev/null
+++ b/mysql-test/suite/sys_vars/inc/autocommit_func2.inc
@@ -0,0 +1,29 @@
+--source include/have_innodb.inc
+
+CREATE TABLE t1
+(
+id INT NOT NULL auto_increment,
+PRIMARY KEY (id),
+name varchar(30)
+) ENGINE = INNODB;
+
+SELECT @@global.autocommit;
+SELECT @@autocommit;
+INSERT into t1(name) values('Record_1');
+INSERT into t1(name) values('Record_2');
+SELECT * from t1;
+ROLLBACK;
+SELECT * from t1;
+
+set @@global.autocommit = 1-@@global.autocommit;
+set @@autocommit = 1-@@autocommit;
+SELECT @@global.autocommit;
+SELECT @@autocommit;
+INSERT into t1(name) values('Record_1');
+INSERT into t1(name) values('Record_2');
+SELECT * from t1;
+ROLLBACK;
+SELECT * from t1;
+
+DROP TABLE t1;
+set @@global.autocommit = 1-@@global.autocommit;
diff --git a/mysql-test/suite/sys_vars/inc/bin_relay_log_basename_index.inc b/mysql-test/suite/sys_vars/inc/bin_relay_log_basename_index.inc
new file mode 100644
index 00000000..58d6ce2d
--- /dev/null
+++ b/mysql-test/suite/sys_vars/inc/bin_relay_log_basename_index.inc
@@ -0,0 +1,55 @@
+# ==== Usage ====
+# [--let $rpl_debug=1]
+# --let $rpl_log_var_name= log_bin_basename|relay_log_basename|...
+# --source suite/sys_vars/inc/bin_relay_log_basename_index.inc
+#
+# $rpl_log_var_name
+# The name of the variable to test, i.e., one of:
+# - log_bin_basename
+# - relay_log_basename
+# - log_bin_index
+# - relay_log_index
+#
+# $rpl_debug
+# See include/rpl_init.inc
+
+if ($rpl_debug)
+{
+ --echo Testing variable named: $rpl_log_var_name
+}
+
+--let $basename= `SELECT @@global.$rpl_log_var_name`
+
+#
+# Assert that the variable is indeed only global
+#
+--replace_result $basename REPLACED
+--eval select @@global.$rpl_log_var_name
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+--eval select @@session.$rpl_log_var_name
+
+#
+# Assert that it is retrievable
+#
+--replace_result $basename REPLACED
+--eval show global variables like '$rpl_log_var_name'
+
+--replace_result $basename REPLACED
+--eval show session variables like '$rpl_log_var_name'
+
+--replace_result $basename REPLACED
+--eval select * from information_schema.global_variables where variable_name='$rpl_log_var_name'
+
+--replace_result $basename REPLACED
+--eval select * from information_schema.session_variables where variable_name='$rpl_log_var_name'
+
+#
+# Assert it is read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+--eval set global $rpl_log_var_name=1
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+--eval set session $rpl_log_var_name=1
+
diff --git a/mysql-test/suite/sys_vars/inc/charset_basic.inc b/mysql-test/suite/sys_vars/inc/charset_basic.inc
new file mode 100644
index 00000000..e3331697
--- /dev/null
+++ b/mysql-test/suite/sys_vars/inc/charset_basic.inc
@@ -0,0 +1,81 @@
+#
+# This auxiliary script is used by character set test cases.
+#
+
+
+
+--Error 0,ER_UNKNOWN_CHARACTER_SET
+eval SET $charset_variable = big5;
+eval SELECT $charset_variable;
+eval SET $charset_variable = dec8;
+eval SELECT $charset_variable;
+eval SET $charset_variable = cp850;
+eval SELECT $charset_variable;
+eval SET $charset_variable = hp8;
+eval SELECT $charset_variable;
+eval SET $charset_variable = koi8r;
+eval SELECT $charset_variable;
+eval SET $charset_variable = latin1;
+eval SELECT $charset_variable;
+eval SET $charset_variable = latin2;
+eval SELECT $charset_variable;
+eval SET $charset_variable = swe7;
+eval SELECT $charset_variable;
+eval SET $charset_variable = ascii;
+eval SELECT $charset_variable;
+eval SET $charset_variable = ujis;
+eval SELECT $charset_variable;
+eval SET $charset_variable = sjis;
+eval SELECT $charset_variable;
+eval SET $charset_variable = hebrew;
+eval SELECT $charset_variable;
+eval SET $charset_variable = tis620;
+eval SELECT $charset_variable;
+eval SET $charset_variable = euckr;
+eval SELECT $charset_variable;
+eval SET $charset_variable = koi8u;
+eval SELECT $charset_variable;
+eval SET $charset_variable = gb2312;
+eval SELECT $charset_variable;
+eval SET $charset_variable = greek;
+eval SELECT $charset_variable;
+eval SET $charset_variable = cp1250;
+eval SELECT $charset_variable;
+eval SET $charset_variable = gbk;
+eval SELECT $charset_variable;
+eval SET $charset_variable = latin5;
+eval SELECT $charset_variable;
+eval SET $charset_variable = armscii8;
+eval SELECT $charset_variable;
+eval SET $charset_variable = utf8;
+eval SELECT $charset_variable;
+# Error with Linux
+--error 0,ER_WRONG_VALUE_FOR_VAR
+eval SET $charset_variable = ucs2;
+eval SELECT $charset_variable;
+eval SET $charset_variable = cp866;
+eval SELECT $charset_variable;
+eval SET $charset_variable = keybcs2;
+eval SELECT $charset_variable;
+eval SET $charset_variable = macce;
+eval SELECT $charset_variable;
+eval SET $charset_variable = macroman;
+eval SELECT $charset_variable;
+eval SET $charset_variable = cp852;
+eval SELECT $charset_variable;
+eval SET $charset_variable = latin7;
+eval SELECT $charset_variable;
+eval SET $charset_variable = cp1251;
+eval SELECT $charset_variable;
+eval SET $charset_variable = cp1256;
+eval SELECT $charset_variable;
+eval SET $charset_variable = cp1257;
+eval SELECT $charset_variable;
+eval SET $charset_variable = binary;
+eval SELECT $charset_variable;
+eval SET $charset_variable = geostd8;
+eval SELECT $charset_variable;
+eval SET $charset_variable = cp932;
+eval SELECT $charset_variable;
+eval SET $charset_variable = eucjpms;
+eval SELECT $charset_variable;
diff --git a/mysql-test/suite/sys_vars/inc/collation_basic.inc b/mysql-test/suite/sys_vars/inc/collation_basic.inc
new file mode 100644
index 00000000..14b9ae4a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/inc/collation_basic.inc
@@ -0,0 +1,260 @@
+#
+# This auxiliary file is used by collation variables
+#
+--Error 0,ER_UNKNOWN_CHARACTER_SET
+eval SET $collation_variable = big5_chinese_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = big5_bin;
+eval SELECT $collation_variable;
+eval SET $collation_variable = dec8_swedish_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = dec8_bin;
+eval SELECT $collation_variable;
+eval SET $collation_variable = cp850_general_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = cp850_bin;
+eval SELECT $collation_variable;
+eval SET $collation_variable = hp8_english_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = hp8_bin;
+eval SELECT $collation_variable;
+eval SET $collation_variable = koi8r_general_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = koi8r_bin;
+eval SELECT $collation_variable;
+eval SET $collation_variable = latin1_german1_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = latin1_swedish_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = latin1_danish_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = latin1_german2_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = latin1_bin;
+eval SELECT $collation_variable;
+eval SET $collation_variable = latin1_general_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = latin1_general_cs;
+eval SELECT $collation_variable;
+eval SET $collation_variable = latin1_spanish_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = latin2_czech_cs;
+eval SELECT $collation_variable;
+eval SET $collation_variable = latin2_general_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = latin2_hungarian_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = latin2_croatian_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = latin2_bin;
+eval SELECT $collation_variable;
+eval SET $collation_variable = swe7_swedish_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = swe7_bin;
+eval SELECT $collation_variable;
+eval SET $collation_variable = ascii_general_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = ascii_bin;
+eval SELECT $collation_variable;
+eval SET $collation_variable = ujis_japanese_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = ujis_bin;
+eval SELECT $collation_variable;
+eval SET $collation_variable = sjis_japanese_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = sjis_bin;
+eval SELECT $collation_variable;
+eval SET $collation_variable = hebrew_general_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = hebrew_bin;
+eval SELECT $collation_variable;
+eval SET $collation_variable = tis620_thai_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = tis620_bin;
+eval SELECT $collation_variable;
+eval SET $collation_variable = euckr_korean_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = euckr_bin;
+eval SELECT $collation_variable;
+eval SET $collation_variable = koi8u_general_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = koi8u_bin;
+eval SELECT $collation_variable;
+eval SET $collation_variable = gb2312_chinese_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = gb2312_bin;
+eval SELECT $collation_variable;
+eval SET $collation_variable = greek_general_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = greek_bin;
+eval SELECT $collation_variable;
+eval SET $collation_variable = cp1250_general_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = cp1250_czech_cs;
+eval SELECT $collation_variable;
+eval SET $collation_variable = cp1250_croatian_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = cp1250_bin;
+eval SELECT $collation_variable;
+eval SET $collation_variable = cp1250_polish_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = gbk_chinese_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = gbk_bin;
+eval SELECT $collation_variable;
+eval SET $collation_variable = latin5_turkish_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = latin5_bin;
+eval SELECT $collation_variable;
+eval SET $collation_variable = armscii8_general_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = armscii8_bin;
+eval SELECT $collation_variable;
+eval SET $collation_variable = utf8_general_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = utf8_bin;
+eval SELECT $collation_variable;
+eval SET $collation_variable = utf8_unicode_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = utf8_icelandic_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = utf8_latvian_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = utf8_romanian_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = utf8_slovenian_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = utf8_polish_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = utf8_estonian_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = utf8_spanish_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = utf8_swedish_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = utf8_turkish_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = utf8_czech_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = utf8_danish_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = utf8_lithuanian_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = utf8_slovak_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = utf8_spanish2_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = utf8_roman_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = utf8_persian_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = utf8_esperanto_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = utf8_hungarian_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = utf8_thai_520_w2;
+eval SELECT $collation_variable;
+eval SET $collation_variable = ucs2_general_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = ucs2_bin;
+eval SELECT $collation_variable;
+eval SET $collation_variable = ucs2_unicode_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = ucs2_icelandic_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = ucs2_latvian_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = ucs2_romanian_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = ucs2_slovenian_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = ucs2_polish_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = ucs2_estonian_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = ucs2_spanish_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = ucs2_swedish_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = ucs2_turkish_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = ucs2_czech_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = ucs2_danish_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = ucs2_lithuanian_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = ucs2_slovak_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = ucs2_spanish2_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = ucs2_roman_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = ucs2_persian_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = ucs2_esperanto_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = ucs2_hungarian_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = cp866_general_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = cp866_bin;
+eval SELECT $collation_variable;
+eval SET $collation_variable = keybcs2_general_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = keybcs2_bin;
+eval SELECT $collation_variable;
+eval SET $collation_variable = macce_general_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = macce_bin;
+eval SELECT $collation_variable;
+eval SET $collation_variable = macroman_general_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = macroman_bin;
+eval SELECT $collation_variable;
+eval SET $collation_variable = cp852_general_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = cp852_bin;
+eval SELECT $collation_variable;
+eval SET $collation_variable = latin7_estonian_cs;
+eval SELECT $collation_variable;
+eval SET $collation_variable = latin7_general_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = latin7_general_cs;
+eval SELECT $collation_variable;
+eval SET $collation_variable = latin7_bin;
+eval SELECT $collation_variable;
+eval SET $collation_variable = cp1251_bulgarian_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = cp1251_ukrainian_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = cp1251_bin;
+eval SELECT $collation_variable;
+eval SET $collation_variable = cp1251_general_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = cp1251_general_cs;
+eval SELECT $collation_variable;
+eval SET $collation_variable = cp1256_general_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = cp1256_bin;
+eval SELECT $collation_variable;
+eval SET $collation_variable = cp1257_lithuanian_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = cp1257_bin;
+eval SELECT $collation_variable;
+eval SET $collation_variable = cp1257_general_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = binary;
+eval SELECT $collation_variable;
+eval SET $collation_variable = geostd8_general_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = geostd8_bin;
+eval SELECT $collation_variable;
+eval SET $collation_variable = cp932_japanese_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = cp932_bin;
+eval SELECT $collation_variable;
+eval SET $collation_variable = eucjpms_japanese_ci;
+eval SELECT $collation_variable;
+eval SET $collation_variable = eucjpms_bin;
+eval SELECT $collation_variable;
diff --git a/mysql-test/suite/sys_vars/inc/explicit_defaults_for_timestamp.inc b/mysql-test/suite/sys_vars/inc/explicit_defaults_for_timestamp.inc
new file mode 100644
index 00000000..0cd8aa2c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/inc/explicit_defaults_for_timestamp.inc
@@ -0,0 +1,134 @@
+CREATE TABLE t1 (a TIMESTAMP);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+CREATE TABLE t1 (a TIMESTAMP NULL);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TIMESTAMP DEFAULT NULL);
+INSERT t1 () VALUES ();
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TIMESTAMP DEFAULT '0000-00-00 00:00:00');
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+CREATE TABLE t1 (a TIMESTAMP DEFAULT '2001-01-01 10:20:30');
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+CREATE TABLE t1 (a TIMESTAMP DEFAULT CURRENT_TIMESTAMP);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (a TIMESTAMP NULL DEFAULT NULL);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+CREATE TABLE t1 (a TIMESTAMP NULL DEFAULT '0000-00-00 00:00:00');
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+CREATE TABLE t1 (a TIMESTAMP NULL DEFAULT '2001-01-01 10:20:30');
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+CREATE TABLE t1 (a TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00');
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+CREATE TABLE t1 (a TIMESTAMP NOT NULL DEFAULT '2001-01-01 10:20:30');
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+CREATE TABLE t1 (a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP NOT NULL);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP NULL);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP DEFAULT '0000-00-00 00:00:00');
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP NULL DEFAULT '0000-00-00 00:00:00');
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00');
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP DEFAULT CURRENT_TIMESTAMP);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (a TIMESTAMP) AS SELECT 1 AS i;
+SHOW CREATE TABLE t1;
+CREATE TABLE t2 (b TIMESTAMP) AS SELECT a FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (a INT);
+ALTER TABLE t1 ADD b TIMESTAMP;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-10802 TIMESTAMP NOT NULL field with explicit_defaults_for_timestamp and NO_ZERO_DATE shouldn't throw error
+--echo #
+
+SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30');
+SET sql_mode='ANSI,NO_ZERO_DATE';
+CREATE TABLE t1 (a TIMESTAMP NOT NULL);
+INSERT INTO t1 VALUES ();
+SELECT * FROM t1;
+DROP TABLE t1;
+SET sql_mode=DEFAULT;
+SET timestamp=DEFAULT;
+
+--echo #
+--echo # MDEV-29075 Changing explicit_defaults_for_timestamp within stored procedure works inconsistently
+--echo #
+set statement explicit_defaults_for_timestamp=1-@@explicit_defaults_for_timestamp for create table t1 (ts timestamp);
+show create table t1;
+drop table t1;
+
+--delimiter $
+create procedure pr()
+begin
+ set explicit_defaults_for_timestamp= 1-@@explicit_defaults_for_timestamp;
+ create table t1 (ts timestamp);
+end $
+--delimiter ;
+
+call pr();
+show create table t1;
+drop procedure pr;
+drop table t1;
+
+prepare stmt from 'create or replace table t1 (a timestamp)';
+execute stmt;
+show create table t1;
+set explicit_defaults_for_timestamp=1-@@explicit_defaults_for_timestamp;
+execute stmt;
+show create table t1;
+set explicit_defaults_for_timestamp=1-@@explicit_defaults_for_timestamp;
+execute stmt;
+show create table t1;
+drop table t1;
diff --git a/mysql-test/suite/sys_vars/inc/secure_timestamp_func.inc b/mysql-test/suite/sys_vars/inc/secure_timestamp_func.inc
new file mode 100644
index 00000000..e097938f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/inc/secure_timestamp_func.inc
@@ -0,0 +1,77 @@
+#
+# MDEV-15923 option to control who can set session @@timestamp
+#
+source include/have_binlog_format_statement.inc;
+source include/master-slave.inc;
+
+connection slave;
+select @@secure_timestamp;
+
+--echo ### ALL PRIVILEGES
+disable_abort_on_error;
+set timestamp=1234567890.101112;
+enable_abort_on_error;
+select if(now(6) > 20100101, 'READONLY', 'EDITABLE') as 'ALL PRIVILEGES';
+set timestamp=default;
+
+--echo ### SUPER
+create user foo@127.0.0.1;
+grant super on *.* TO `foo`@`127.0.0.1`;
+connect con2,127.0.0.1,foo,,"*NO-ONE*",$SLAVE_MYPORT;
+disable_abort_on_error;
+set timestamp=1234567890.101112;
+enable_abort_on_error;
+select if(now(6) > 20100101, 'READONLY', 'EDITABLE') as 'SUPER';
+disconnect con2;
+connection slave;
+drop user foo@127.0.0.1;
+set timestamp=default;
+
+--echo ### BINLOG REPLAY
+create user foo@127.0.0.1;
+grant binlog replay on *.* TO `foo`@`127.0.0.1`;
+connect con2,127.0.0.1,foo,,"*NO-ONE*",$SLAVE_MYPORT;
+disable_abort_on_error;
+set timestamp=1234567890.101112;
+enable_abort_on_error;
+select if(now(6) > 20100101, 'READONLY', 'EDITABLE') as 'BINLOG REPLAY';
+disconnect con2;
+connection slave;
+drop user foo@127.0.0.1;
+set timestamp=default;
+
+--echo ### non-privileged user
+create user foo@127.0.0.1;
+connect con2,127.0.0.1,foo,,"*NO-ONE*",$SLAVE_MYPORT;
+disable_abort_on_error;
+set timestamp=1234567890.101112;
+enable_abort_on_error;
+select if(now(6) > 20100101, 'READONLY', 'EDITABLE') as 'non-privileged';
+disconnect con2;
+connection slave;
+drop user foo@127.0.0.1;
+set timestamp=default;
+
+### replication
+connection master;
+set time_zone='+00:00';
+set timestamp=1234567890.101112;
+select @@timestamp, now(6);
+
+create table t1 (b varchar(20), a timestamp(6) default current_timestamp(6));
+insert t1 (b) values ('replicated');
+sync_slave_with_master;
+create trigger t1rbr before insert on t1 for each row set new.a=now(6);
+set @@global.slave_run_triggers_for_rbr= yes;
+binlog 'LQfqWg8BAAAA/AAAAAABAAABAAQAMTAuMy42LU1hcmlhREItZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAtB+paEzgNAAgAEgAEBAQEEgAA5AAEGggAAAAICAgCAAAACgoKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEEwQADQgICAoKCgFlBcaR';
+binlog '0gKWSRMBAAAAMQAAAHQDAAAAAB8AAAAAAAEABHRlc3QAAnQxAAIPEQMUAAYBQFUzwA==0gKWSRcBAAAAMAAAAKQDAAAAAB8AAAAAAAEAAv/8BmJpbmxvZ0mWAtIBivg3mwo+';
+set @@global.slave_run_triggers_for_rbr= default;
+select b, if(a > 20100101, 'READONLY', 'EDITABLE') as 'REPLICATION' from t1;
+connection master;
+#set binlog_format=row;
+#insert t1 (b) values ('binlog');
+#let datadir=`select @@datadir`;
+#exec $MYSQL_BINLOG $datadir/master-bin.000001;
+drop table t1;
+
+source include/rpl_end.inc;
diff --git a/mysql-test/suite/sys_vars/inc/sysvar_global_and_session_grant.inc b/mysql-test/suite/sys_vars/inc/sysvar_global_and_session_grant.inc
new file mode 100644
index 00000000..0c6d0705
--- /dev/null
+++ b/mysql-test/suite/sys_vars/inc/sysvar_global_and_session_grant.inc
@@ -0,0 +1,49 @@
+--source include/not_embedded.inc
+
+
+--eval SET @global=@@global.$var
+
+--echo # Test that "SET $var" is not allowed without $grant or SUPER
+
+CREATE USER user1@localhost;
+GRANT ALL PRIVILEGES ON *.* TO user1@localhost;
+--eval REVOKE $grant, SUPER ON *.* FROM user1@localhost
+--connect(user1,localhost,user1,,)
+--connection user1
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+--eval SET GLOBAL $var=$value
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+--eval SET $var=$value
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+--eval SET SESSION $var=$value
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET $var" is allowed with $grant
+
+CREATE USER user1@localhost;
+--eval GRANT $grant ON *.* TO user1@localhost
+--connect(user1,localhost,user1,,)
+--connection user1
+--eval SET GLOBAL $var=$value
+--eval SET $var=$value
+--eval SET SESSION $var=$value
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET $var" is allowed with SUPER
+
+CREATE USER user1@localhost;
+GRANT SUPER ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+--eval SET GLOBAL $var=$value
+--eval SET $var=$value
+--eval SET SESSION $var=$value
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--eval SET @@global.$var=@global
diff --git a/mysql-test/suite/sys_vars/inc/sysvar_global_grant.inc b/mysql-test/suite/sys_vars/inc/sysvar_global_grant.inc
new file mode 100644
index 00000000..f452c1b1
--- /dev/null
+++ b/mysql-test/suite/sys_vars/inc/sysvar_global_grant.inc
@@ -0,0 +1,53 @@
+--source include/not_embedded.inc
+
+
+--eval SET @global=@@global.$var
+
+--echo # Test that "SET $var" is not allowed without $grant or SUPER
+
+CREATE USER user1@localhost;
+GRANT ALL PRIVILEGES ON *.* TO user1@localhost;
+--eval REVOKE $grant, SUPER ON *.* FROM user1@localhost
+--connect(user1,localhost,user1,,)
+--connection user1
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+--eval SET GLOBAL $var=$value
+--error ER_GLOBAL_VARIABLE
+--eval SET $var=$value
+--error ER_GLOBAL_VARIABLE
+--eval SET SESSION $var=$value
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET $var" is allowed with $grant
+
+CREATE USER user1@localhost;
+--eval GRANT $grant ON *.* TO user1@localhost
+--connect(user1,localhost,user1,,)
+--connection user1
+--eval SET GLOBAL $var=$value
+--error ER_GLOBAL_VARIABLE
+--eval SET $var=$value
+--error ER_GLOBAL_VARIABLE
+--eval SET SESSION $var=$value
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET $var" is allowed with SUPER
+
+CREATE USER user1@localhost;
+GRANT SUPER ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+--eval SET GLOBAL $var=$value
+--error ER_GLOBAL_VARIABLE
+--eval SET $var=$value
+--error ER_GLOBAL_VARIABLE
+--eval SET SESSION $var=$value
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--eval SET @@global.$var=@global
diff --git a/mysql-test/suite/sys_vars/inc/sysvar_global_grant_alone.inc b/mysql-test/suite/sys_vars/inc/sysvar_global_grant_alone.inc
new file mode 100644
index 00000000..6a1cf1a7
--- /dev/null
+++ b/mysql-test/suite/sys_vars/inc/sysvar_global_grant_alone.inc
@@ -0,0 +1,41 @@
+--source include/not_embedded.inc
+
+
+--eval SET @global=@@global.$var
+
+--echo # Test that "SET GLOBAL $var" is not allowed without $grant or SUPER
+
+CREATE USER user1@localhost;
+GRANT ALL PRIVILEGES ON *.* TO user1@localhost;
+--eval REVOKE $grant, SUPER ON *.* FROM user1@localhost
+--connect(user1,localhost,user1,,)
+--connection user1
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+--eval SET GLOBAL $var=$value
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET GLOBAL $var" is allowed with $grant
+
+CREATE USER user1@localhost;
+--eval GRANT $grant ON *.* TO user1@localhost
+--connect(user1,localhost,user1,,)
+--connection user1
+--eval SET GLOBAL $var=$value
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET GLOBAL $var" is allowed with SUPER
+
+CREATE USER user1@localhost;
+GRANT SUPER ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+--eval SET GLOBAL $var=$value
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--eval SET @@global.$var=@global
diff --git a/mysql-test/suite/sys_vars/inc/sysvar_session_grant.inc b/mysql-test/suite/sys_vars/inc/sysvar_session_grant.inc
new file mode 100644
index 00000000..1cdc6e71
--- /dev/null
+++ b/mysql-test/suite/sys_vars/inc/sysvar_session_grant.inc
@@ -0,0 +1,51 @@
+--source include/not_embedded.inc
+
+
+--eval SET @session=@@session.$var
+
+--echo # Test that "SET $var" is not allowed without $grant or SUPER
+
+CREATE USER user1@localhost;
+GRANT ALL PRIVILEGES ON *.* TO user1@localhost;
+--eval REVOKE $grant, SUPER ON *.* FROM user1@localhost
+--connect(user1,localhost,user1,,)
+--connection user1
+--error ER_LOCAL_VARIABLE
+--eval SET GLOBAL $var=$value
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+--eval SET $var=$value
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+--eval SET SESSION $var=$value
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET $var" is allowed with $grant
+
+CREATE USER user1@localhost;
+--eval GRANT $grant ON *.* TO user1@localhost
+--connect(user1,localhost,user1,,)
+--connection user1
+--error ER_LOCAL_VARIABLE
+--eval SET GLOBAL $var=$value
+--eval SET $var=$value
+--eval SET SESSION $var=$value
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET $var" is allowed with SUPER
+
+CREATE USER user1@localhost;
+GRANT SUPER ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+--error ER_LOCAL_VARIABLE
+--eval SET GLOBAL $var=$value
+--eval SET $var=$value
+--eval SET SESSION $var=$value
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--eval SET @@session.$var=@session
diff --git a/mysql-test/suite/sys_vars/inc/sysvar_session_grant_alone.inc b/mysql-test/suite/sys_vars/inc/sysvar_session_grant_alone.inc
new file mode 100644
index 00000000..af38623a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/inc/sysvar_session_grant_alone.inc
@@ -0,0 +1,45 @@
+--source include/not_embedded.inc
+
+
+--eval SET @session=@@session.$var
+
+--echo # Test that "SET $var" is not allowed without $grant or SUPER
+
+CREATE USER user1@localhost;
+GRANT ALL PRIVILEGES ON *.* TO user1@localhost;
+--eval REVOKE $grant, SUPER ON *.* FROM user1@localhost
+--connect(user1,localhost,user1,,)
+--connection user1
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+--eval SET $var=$value
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+--eval SET SESSION $var=$value
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET $var" is allowed with $grant
+
+CREATE USER user1@localhost;
+--eval GRANT $grant ON *.* TO user1@localhost
+--connect(user1,localhost,user1,,)
+--connection user1
+--eval SET $var=$value
+--eval SET SESSION $var=$value
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET $var" is allowed with SUPER
+
+CREATE USER user1@localhost;
+GRANT SUPER ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+--eval SET $var=$value
+--eval SET SESSION $var=$value
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--eval SET @@session.$var=@session
diff --git a/mysql-test/suite/sys_vars/inc/sysvars_server.inc b/mysql-test/suite/sys_vars/inc/sysvars_server.inc
new file mode 100644
index 00000000..8fca98e0
--- /dev/null
+++ b/mysql-test/suite/sys_vars/inc/sysvars_server.inc
@@ -0,0 +1,39 @@
+--source include/have_perfschema.inc
+--source include/word_size.inc
+--source include/platform.inc
+--vertical_results
+
+# need stable timestamp, because its current value is printed below
+set time_zone='+00:00';
+set timestamp=unix_timestamp('2014-09-01 13:40:23');
+# ditto
+set pseudo_thread_id=10;
+# to show session != global, and doesn't affect global_value_origin
+set sql_mode=ansi_quotes;
+# global_value_origin=SQL
+set global div_precision_increment=5;
+
+# Don't show values or origin as they may have been changed by the test
+# or different recompilation. Remove variables that are depending on
+# configuration options
+
+--replace_regex /^\/\S+/PATH/
+select VARIABLE_NAME,VARIABLE_SCOPE,VARIABLE_TYPE,VARIABLE_COMMENT,NUMERIC_MIN_VALUE,NUMERIC_MAX_VALUE,NUMERIC_BLOCK_SIZE,ENUM_VALUE_LIST,READ_ONLY,COMMAND_LINE_ARGUMENT
+ from information_schema.system_variables
+ where variable_name not like 'debug%' and
+ variable_name not like 'wsrep%' and
+ variable_name not like 's3%' and
+ variable_name not in (
+ 'log_tc_size','have_sanitizer'
+ )
+ order by variable_name;
+
+# yet less data: no values, no blocks size, no min/max value.
+select VARIABLE_NAME, GLOBAL_VALUE_ORIGIN, VARIABLE_SCOPE, VARIABLE_TYPE, VARIABLE_COMMENT, ENUM_VALUE_LIST, READ_ONLY, COMMAND_LINE_ARGUMENT
+ from information_schema.system_variables
+ where variable_name in (
+ 'log_tc_size'
+ )
+ order by variable_name;
+
+set global div_precision_increment=default;
diff --git a/mysql-test/suite/sys_vars/inc/sysvars_server.opt b/mysql-test/suite/sys_vars/inc/sysvars_server.opt
new file mode 100644
index 00000000..850203a1
--- /dev/null
+++ b/mysql-test/suite/sys_vars/inc/sysvars_server.opt
@@ -0,0 +1 @@
+--auto-increment-increment=1 --loose-thread-pool-size=4