mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 12:32:27 +01:00
ffbb2bbc09
This is covered in mysql-test/t/variables.test. There is no sense to test this for every individual variables. This is to reduce the coming soon patch for ROW-type routine variables, which will change the error from ER_PARSE_ERROR to a new error "unknown structured variable".
168 lines
6.7 KiB
Text
168 lines
6.7 KiB
Text
############## mysql-test\t\read_only_basic.test ###############
|
|
# #
|
|
# Variable Name: read_only #
|
|
# Scope: GLOBAL #
|
|
# Access Type: Dynamic #
|
|
# Data Type: numeric #
|
|
# Default Value: 0 #
|
|
# Range: - #
|
|
# #
|
|
# #
|
|
# Creation Date: 2008-02-07 #
|
|
# Author: Salman #
|
|
# #
|
|
# Description: Test Cases of Dynamic System Variable read_only #
|
|
# that checks the behavior of this variable in the following ways#
|
|
# * Default Value #
|
|
# * Valid & Invalid values #
|
|
# * Scope & Access method #
|
|
# * Data Integrity #
|
|
# #
|
|
# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
|
|
# server-system-variables.html #
|
|
# #
|
|
###############################################################################
|
|
|
|
--source include/load_sysvars.inc
|
|
|
|
|
|
################################################################
|
|
# START OF read_only TESTS #
|
|
################################################################
|
|
|
|
|
|
################################################################
|
|
# Saving initial value of read_only in a temporary variable #
|
|
################################################################
|
|
|
|
SET @start_value = @@global.read_only;
|
|
SELECT @start_value;
|
|
|
|
|
|
--echo '#--------------------FN_DYNVARS_139_01------------------------#'
|
|
################################################################
|
|
# Display the DEFAULT value of read_only #
|
|
################################################################
|
|
|
|
SET @@global.read_only = 1;
|
|
SET @@global.read_only = DEFAULT;
|
|
SELECT @@global.read_only;
|
|
|
|
|
|
--echo '#---------------------FN_DYNVARS_139_02-------------------------#'
|
|
###############################################
|
|
# Verify default value of variable #
|
|
###############################################
|
|
|
|
SET @@global.read_only = @start_value;
|
|
SELECT @@global.read_only = 0;
|
|
|
|
|
|
--echo '#--------------------FN_DYNVARS_139_03------------------------#'
|
|
#################################################################
|
|
# Change the value of read_only to a valid value #
|
|
#################################################################
|
|
|
|
SET @@global.read_only = 0;
|
|
SELECT @@global.read_only;
|
|
SET @@global.read_only = 1;
|
|
SELECT @@global.read_only;
|
|
SET @@global.read_only = TRUE;
|
|
SELECT @@global.read_only;
|
|
SET @@global.read_only = FALSE;
|
|
SELECT @@global.read_only;
|
|
SET @@global.read_only = ON;
|
|
SELECT @@global.read_only;
|
|
SET @@global.read_only = OFF;
|
|
SELECT @@global.read_only;
|
|
|
|
--echo '#--------------------FN_DYNVARS_139_04-------------------------#'
|
|
####################################################################
|
|
# Change the value of read_only to invalid value #
|
|
####################################################################
|
|
|
|
--Error ER_WRONG_VALUE_FOR_VAR
|
|
SET @@global.read_only = -1;
|
|
SELECT @@global.read_only;
|
|
--Error ER_WRONG_VALUE_FOR_VAR
|
|
SET @@global.read_only = 4294967296;
|
|
SELECT @@global.read_only;
|
|
--Error ER_WRONG_VALUE_FOR_VAR
|
|
SET @@global.read_only = 10240022115;
|
|
SELECT @@global.read_only;
|
|
--Error ER_WRONG_TYPE_FOR_VAR
|
|
SET @@global.read_only = 10000.01;
|
|
SELECT @@global.read_only;
|
|
--Error ER_WRONG_VALUE_FOR_VAR
|
|
SET @@global.read_only = -1024;
|
|
SELECT @@global.read_only;
|
|
--Error ER_WRONG_VALUE_FOR_VAR
|
|
SET @@global.read_only = 42949672950;
|
|
SELECT @@global.read_only;
|
|
|
|
--Error ER_WRONG_VALUE_FOR_VAR
|
|
SET @@global.read_only = 'test';
|
|
SELECT @@global.read_only;
|
|
|
|
|
|
--echo '#-------------------FN_DYNVARS_139_05----------------------------#'
|
|
####################################################################
|
|
# Test if accessing session read_only gives error #
|
|
####################################################################
|
|
|
|
--Error ER_GLOBAL_VARIABLE
|
|
SET @@session.read_only = 0;
|
|
SELECT @@read_only;
|
|
|
|
|
|
--echo '#----------------------FN_DYNVARS_139_06------------------------#'
|
|
##############################################################################
|
|
# Check if the value in GLOBAL & SESSION Tables matches values in variable #
|
|
##############################################################################
|
|
|
|
SELECT IF(@@global.read_only, "ON", "OFF") = VARIABLE_VALUE
|
|
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
|
WHERE VARIABLE_NAME='read_only';
|
|
|
|
SELECT IF(@@read_only, "ON", "OFF") = VARIABLE_VALUE
|
|
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
|
|
WHERE VARIABLE_NAME='read_only';
|
|
|
|
|
|
--echo '#---------------------FN_DYNVARS_139_07----------------------#'
|
|
########################################################################################################
|
|
# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
|
|
########################################################################################################
|
|
|
|
SET @@global.read_only = 1;
|
|
SELECT @@read_only = @@global.read_only;
|
|
|
|
|
|
--echo '#---------------------FN_DYNVARS_139_08----------------------#'
|
|
###################################################################
|
|
# Check if read_only can be accessed with and without @@ sign #
|
|
###################################################################
|
|
|
|
--Error ER_GLOBAL_VARIABLE
|
|
SET read_only = 1;
|
|
SELECT @@read_only;
|
|
--Error ER_UNKNOWN_TABLE
|
|
SELECT local.read_only;
|
|
--Error ER_UNKNOWN_TABLE
|
|
SELECT global.read_only;
|
|
--Error ER_BAD_FIELD_ERROR
|
|
SELECT read_only = @@session.read_only;
|
|
|
|
|
|
##############################
|
|
# Restore initial value #
|
|
##############################
|
|
|
|
SET @@global.read_only = @start_value;
|
|
SELECT @@global.read_only;
|
|
|
|
|
|
#################################################################
|
|
# END OF read_only TESTS #
|
|
#################################################################
|
|
|