Commit 0ac51325 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-29227 deprecate explicit_defaults_for_timestamp=0

parent 760d1490
......@@ -1326,6 +1326,8 @@ SET timestamp=DEFAULT;
# MDEV-29225 make explicit_defaults_for_timestamps SESSION variable
#
set explicit_defaults_for_timestamp=OFF;
Warnings:
Warning 1681 'explicit_defaults_for_timestamp=0' is deprecated and will be removed in a future release
create table t1 (f1 timestamp, f2 timestamp);
show create table t1;
Table Create Table
......
......@@ -48,6 +48,8 @@ ROLLBACK /* added by mysqlbinlog */;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
connection slave;
set global explicit_defaults_for_timestamp=0;
Warnings:
Warning 1681 'explicit_defaults_for_timestamp=0' is deprecated and will be removed in a future release
include/reset_slave.inc
include/start_slave.inc
show create table t1;
......
......@@ -10,6 +10,8 @@ set @@session.explicit_defaults_for_timestamp = 1;
connection slave;
set @sav.explicit_defaults_for_timestamp = @@global.explicit_defaults_for_timestamp;
set global explicit_defaults_for_timestamp = 0;
Warnings:
Warning 1681 'explicit_defaults_for_timestamp=0' is deprecated and will be removed in a future release
set @sav.slave_parallel_workers = @@global.slave_parallel_workers;
include/stop_slave.inc
set @@global.slave_parallel_workers = 1;
......@@ -105,6 +107,8 @@ connection slave;
# B. alternate the master and slave vars' values to (0,1)
connection master;
set @@session.explicit_defaults_for_timestamp = 0;
Warnings:
Warning 1681 'explicit_defaults_for_timestamp=0' is deprecated and will be removed in a future release
connection slave;
set @@global.explicit_defaults_for_timestamp = 1;
connection slave;
......
......@@ -2,6 +2,8 @@ include/master-slave.inc
[connection master]
set timestamp=1656940000;
set explicit_defaults_for_timestamp=!@@explicit_defaults_for_timestamp;
Warnings:
Warning 1681 'explicit_defaults_for_timestamp=0' is deprecated and will be removed in a future release
connection master;
create table t1 (f1 timestamp, f2 timestamp);
show create table t1;
......
......@@ -105,7 +105,9 @@ SET timestamp=DEFAULT;
--echo #
--echo # MDEV-29075 Changing explicit_defaults_for_timestamp within stored procedure works inconsistently
--echo #
--disable_warnings
set statement explicit_defaults_for_timestamp=1-@@explicit_defaults_for_timestamp for create table t1 (ts timestamp);
--enable_warnings
show create table t1;
drop table t1;
......
set @@explicit_defaults_for_timestamp=0;
Warnings:
Warning 1681 'explicit_defaults_for_timestamp=0' is deprecated and will be removed in a future release
CREATE TABLE t1 (a TIMESTAMP);
SHOW CREATE TABLE t1;
Table Create Table
......@@ -224,6 +226,8 @@ t1 CREATE TABLE `t1` (
`a` timestamp NULL DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
set explicit_defaults_for_timestamp=1-@@explicit_defaults_for_timestamp;
Warnings:
Warning 1681 'explicit_defaults_for_timestamp=0' is deprecated and will be removed in a future release
execute stmt;
show create table t1;
Table Create Table
......
......@@ -233,6 +233,8 @@ t1 CREATE TABLE `t1` (
`a` timestamp NULL DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
set explicit_defaults_for_timestamp=1-@@explicit_defaults_for_timestamp;
Warnings:
Warning 1681 'explicit_defaults_for_timestamp=0' is deprecated and will be removed in a future release
execute stmt;
show create table t1;
Table Create Table
......
......@@ -723,13 +723,24 @@ Sys_binlog_direct(
CMD_LINE(OPT_ARG), DEFAULT(FALSE),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(binlog_direct_check));
static bool deprecated_explicit_defaults_for_timestamp(sys_var *self, THD *thd,
set_var *var)
{
if (var->value && var->save_result.ulonglong_value == 0)
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,
ER_THD(thd, ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT),
"explicit_defaults_for_timestamp=0"); // since 11.0.0
return false;
}
static Sys_var_bit Sys_explicit_defaults_for_timestamp(
"explicit_defaults_for_timestamp",
"This option causes CREATE TABLE to create all TIMESTAMP columns "
"as NULL with DEFAULT NULL attribute, Without this option, "
"TIMESTAMP columns are NOT NULL and have implicit DEFAULT clauses.",
SESSION_VAR(option_bits), CMD_LINE(OPT_ARG),
OPTION_EXPLICIT_DEF_TIMESTAMP, DEFAULT(TRUE), NO_MUTEX_GUARD, IN_BINLOG);
OPTION_EXPLICIT_DEF_TIMESTAMP, DEFAULT(TRUE), NO_MUTEX_GUARD, IN_BINLOG,
ON_CHECK(deprecated_explicit_defaults_for_timestamp));
static Sys_var_ulonglong Sys_bulk_insert_buff_size(
"bulk_insert_buffer_size", "Size of tree cache used in bulk "
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment