|
| 1 | +flush privileges; |
| 2 | +create user usr1@localhost; |
| 3 | +grant all privileges on *.* to admin1@localhost identified by password '' with grant option; |
| 4 | +flush user_resources; |
| 5 | +SET @original_val = @@global.per_user_session_var_default_val; |
| 6 | +SELECT @original_val; |
| 7 | +@original_val |
| 8 | +NULL |
| 9 | +## default value is NULL |
| 10 | +SET GLOBAL per_user_session_var_default_val = DEFAULT; |
| 11 | +SELECT @@GLOBAL.per_user_session_var_default_val; |
| 12 | +@@GLOBAL.per_user_session_var_default_val |
| 13 | +NULL |
| 14 | +## NULL is a valid value |
| 15 | +SET GLOBAL per_user_session_var_default_val = NULL; |
| 16 | +SELECT @@GLOBAL.per_user_session_var_default_val; |
| 17 | +@@GLOBAL.per_user_session_var_default_val |
| 18 | +NULL |
| 19 | +## "" is a valid value |
| 20 | +SET GLOBAL per_user_session_var_default_val = ""; |
| 21 | +SELECT @@GLOBAL.per_user_session_var_default_val; |
| 22 | +@@GLOBAL.per_user_session_var_default_val |
| 23 | + |
| 24 | +## |
| 25 | +## Invalid values. SET command will fail |
| 26 | +## |
| 27 | +SET GLOBAL per_user_session_var_default_val = " "; |
| 28 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of ' ' |
| 29 | +SET GLOBAL per_user_session_var_default_val = " "; |
| 30 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of ' ' |
| 31 | +SET GLOBAL per_user_session_var_default_val = ":"; |
| 32 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of ':' |
| 33 | +SET GLOBAL per_user_session_var_default_val = "="; |
| 34 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of '=' |
| 35 | +SET GLOBAL per_user_session_var_default_val = ","; |
| 36 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of ',' |
| 37 | +SET GLOBAL per_user_session_var_default_val = ";"; |
| 38 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of ';' |
| 39 | +SET GLOBAL per_user_session_var_default_val = "\""; |
| 40 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of '"' |
| 41 | +SET GLOBAL per_user_session_var_default_val = "'"; |
| 42 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of ''' |
| 43 | +SET GLOBAL per_user_session_var_default_val = "\\"; |
| 44 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of '\' |
| 45 | +SET GLOBAL per_user_session_var_default_val = "/"; |
| 46 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of '/' |
| 47 | +SET GLOBAL per_user_session_var_default_val = "u"; |
| 48 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of 'u' |
| 49 | +SET GLOBAL per_user_session_var_default_val = "gap_lock_raise_error=0"; |
| 50 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of 'gap_lock_raise_error=0' |
| 51 | +SET GLOBAL per_user_session_var_default_val = "gap_lock_raise_error=0,u2:gap_lock_raise_error=1"; |
| 52 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of 'gap_lock_raise_error=0,u2:gap_lock_raise_error=1' |
| 53 | +SET GLOBAL per_user_session_var_default_val = " u"; |
| 54 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of ' u' |
| 55 | +SET GLOBAL per_user_session_var_default_val = "u "; |
| 56 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of 'u ' |
| 57 | +SET GLOBAL per_user_session_var_default_val = "u :"; |
| 58 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of 'u :' |
| 59 | +SET GLOBAL per_user_session_var_default_val = "u:gap_lock_raise_error"; |
| 60 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of 'u:gap_lock_raise_error' |
| 61 | +SET GLOBAL per_user_session_var_default_val = "u: "; |
| 62 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of 'u: ' |
| 63 | +SET GLOBAL per_user_session_var_default_val = " u:gap_lock_raise_error"; |
| 64 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of ' u:gap_lock_raise_error' |
| 65 | +SET GLOBAL per_user_session_var_default_val = "u:v:"; |
| 66 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of 'u:v:' |
| 67 | +SET GLOBAL per_user_session_var_default_val = "u:gap_lock_raise_error="; |
| 68 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of 'u:gap_lock_raise_error=' |
| 69 | +SET GLOBAL per_user_session_var_default_val = "u:gap_lock_raise_error=0:"; |
| 70 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of 'u:gap_lock_raise_error=0:' |
| 71 | +SET GLOBAL per_user_session_var_default_val = "u:gap_lock_raise_error=0="; |
| 72 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of 'u:gap_lock_raise_error=0=' |
| 73 | +SET GLOBAL per_user_session_var_default_val = "u:gap_lock_raise_error=0=1"; |
| 74 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of 'u:gap_lock_raise_error=0=1' |
| 75 | +SET GLOBAL per_user_session_var_default_val = "u:gap_lock_raise_error=0,u:gap_lock_write_log=0"; |
| 76 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of 'u:gap_lock_raise_error=0,u:gap_lock_write_log=0' |
| 77 | +SET GLOBAL per_user_session_var_default_val = "u:= 0"; |
| 78 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of 'u:= 0' |
| 79 | +SET GLOBAL per_user_session_var_default_val = "u:gap_lock_raise_error= 0"; |
| 80 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of 'u:gap_lock_raise_error= 0' |
| 81 | +SET GLOBAL per_user_session_var_default_val = "u:gap_lock_raise_error= "; |
| 82 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of 'u:gap_lock_raise_error= ' |
| 83 | +SET GLOBAL per_user_session_var_default_val = "u:gap_lock_raise_error=0,"; |
| 84 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of 'u:gap_lock_raise_error=0,' |
| 85 | +SET GLOBAL per_user_session_var_default_val = "u:gap_lock_raise_error=0;"; |
| 86 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of 'u:gap_lock_raise_error=0;' |
| 87 | +SET GLOBAL per_user_session_var_default_val = "u1:u2:gap_lock_raise_error=0,gap_lock_write_log=0,,u3:big_tables=1"; |
| 88 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of 'u1:u2:gap_lock_raise_error=0,gap_lock_write_log=0,,u3:big_tables=1' |
| 89 | +SET GLOBAL per_user_session_var_default_val = "u1::u2:gap_lock_raise_error=0,gap_lock_write_log=0,u3:big_tables=1"; |
| 90 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of 'u1::u2:gap_lock_raise_error=0,gap_lock_write_log=0,u3:big_tables=1' |
| 91 | +SET GLOBAL per_user_session_var_default_val = "u1:gap_lock_raise_error=0,gap_lock_write_log=0,u3:big_tables=1 "; |
| 92 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of 'u1:gap_lock_raise_error=0,gap_lock_write_log=0,u3:big_tables=1 ' |
| 93 | +SET GLOBAL per_user_session_var_default_val = "u1:gap_lock_raise_error=0,gap_lock_write_log=0,u3:big_tables=1,"; |
| 94 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of 'u1:gap_lock_raise_error=0,gap_lock_write_log=0,u3:big_tables=1,' |
| 95 | +SET GLOBAL per_user_session_var_default_val = "u1:gap_lock_raise_error=0,gap_lock_write_log=0,u3:big_tables=1'"; |
| 96 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of 'u1:gap_lock_raise_error=0,gap_lock_write_log=0,u3:big_tables=1'' |
| 97 | +SET GLOBAL per_user_session_var_default_val = "u1:gap_lock_raise_error=0,gap_lock_write_log=0,u3:big_tables='1'"; |
| 98 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of 'u1:gap_lock_raise_error=0,gap_lock_write_log=0,u3:big_tables='1'' |
| 99 | +SET GLOBAL per_user_session_var_default_val = "u1:gap_lock_raise_error=0,gap_lock_write_log=0,u3:big_tables=\"1\""; |
| 100 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of 'u1:gap_lock_raise_error=0,gap_lock_write_log=0,u3:big_tables="1"' |
| 101 | +SET GLOBAL per_user_session_var_default_val = "u1:time_zone=\'+10:00\'"; |
| 102 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of 'u1:time_zone='+10:00'' |
| 103 | +## Syntax error |
| 104 | +SET GLOBAL per_user_session_var_default_val = "u1:optimizer_switch=index_merge=on"; |
| 105 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of 'u1:optimizer_switch=index_merge=on' |
| 106 | +## Unsupported type 'flagset' |
| 107 | +SET GLOBAL per_user_session_var_default_val = "u1:optimizer_switch=xyz"; |
| 108 | +ERROR 42000: Variable 'per_user_session_var_default_val' can't be set to the value of 'u1:optimizer_switch=xyz' |
| 109 | +## |
| 110 | +## root privilege is required to set session variable binglog_format |
| 111 | +## root privilege will be granted to usr1 temporarily to get this done |
| 112 | +## |
| 113 | +SET GLOBAL per_user_session_var_default_val = "usr1:binlog_format=MIXED"; |
| 114 | +SELECT @@GLOBAL.binlog_format, @@SESSION.binlog_format; |
| 115 | +@@GLOBAL.binlog_format @@SESSION.binlog_format |
| 116 | +STATEMENT MIXED |
| 117 | +SET GLOBAL per_user_session_var_default_val = "usr1:binlog_format=ROW"; |
| 118 | +SELECT @@GLOBAL.binlog_format, @@SESSION.binlog_format; |
| 119 | +@@GLOBAL.binlog_format @@SESSION.binlog_format |
| 120 | +STATEMENT ROW |
| 121 | +SET GLOBAL per_user_session_var_default_val = "admin1:binlog_format=MIXED"; |
| 122 | +SELECT @@GLOBAL.binlog_format, @@SESSION.binlog_format; |
| 123 | +@@GLOBAL.binlog_format @@SESSION.binlog_format |
| 124 | +STATEMENT MIXED |
| 125 | +SET GLOBAL per_user_session_var_default_val = "admin1:binlog_format=ROW"; |
| 126 | +SELECT @@GLOBAL.binlog_format, @@SESSION.binlog_format; |
| 127 | +@@GLOBAL.binlog_format @@SESSION.binlog_format |
| 128 | +STATEMENT ROW |
| 129 | +drop user usr1@localhost; |
| 130 | +drop user admin1@localhost; |
| 131 | +SET @@global.per_user_session_var_default_val = @original_val; |
| 132 | +SELECT @@global.per_user_session_var_default_val; |
| 133 | +@@global.per_user_session_var_default_val |
| 134 | +NULL |
0 commit comments