--source include/have_innodb.inc
--source include/have_debug.inc

SET @start_global_value = @@global.innodb_trx_purge_view_update_only_debug;
SELECT @start_global_value;

#
# exists as global only
#
select @@global.innodb_trx_purge_view_update_only_debug in (0, 1);
select @@global.innodb_trx_purge_view_update_only_debug;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
select @@session.innodb_trx_purge_view_update_only_debug;
show global variables like 'innodb_trx_purge_view_update_only_debug';
show session variables like 'innodb_trx_purge_view_update_only_debug';
--disable_warnings
select * from information_schema.global_variables where variable_name='innodb_trx_purge_view_update_only_debug';
select * from information_schema.session_variables where variable_name='innodb_trx_purge_view_update_only_debug';
--enable_warnings

#
# show that it's writable
#
set global innodb_trx_purge_view_update_only_debug=1;
select @@global.innodb_trx_purge_view_update_only_debug;
--disable_warnings
select * from information_schema.global_variables where variable_name='innodb_trx_purge_view_update_only_debug';
select * from information_schema.session_variables where variable_name='innodb_trx_purge_view_update_only_debug';
--enable_warnings
set @@global.innodb_trx_purge_view_update_only_debug=0;
select @@global.innodb_trx_purge_view_update_only_debug;
--disable_warnings
select * from information_schema.global_variables where variable_name='innodb_trx_purge_view_update_only_debug';
select * from information_schema.session_variables where variable_name='innodb_trx_purge_view_update_only_debug';
--enable_warnings
--error ER_GLOBAL_VARIABLE
set session innodb_trx_purge_view_update_only_debug='some';
--error ER_GLOBAL_VARIABLE
set @@session.innodb_trx_purge_view_update_only_debug='some';

#
# incorrect types
#
--error ER_WRONG_TYPE_FOR_VAR
set global innodb_trx_purge_view_update_only_debug=1.1;
--error ER_WRONG_VALUE_FOR_VAR
set global innodb_trx_purge_view_update_only_debug='foo';
--error ER_WRONG_VALUE_FOR_VAR
set global innodb_trx_purge_view_update_only_debug=-2;
--error ER_WRONG_TYPE_FOR_VAR
set global innodb_trx_purge_view_update_only_debug=1e1;
--error ER_WRONG_VALUE_FOR_VAR
set global innodb_trx_purge_view_update_only_debug=2;

#
# Cleanup
#

SET @@global.innodb_trx_purge_view_update_only_debug = @start_global_value;
SELECT @@global.innodb_trx_purge_view_update_only_debug;
