summaryrefslogtreecommitdiff
path: root/mysql-test/suite/sys_vars/t/last_insert_id_basic.test
blob: ca971c660ca0833b2de66b9f75c6f4760db68f48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

#
# exists as a session only
#
# 2010-01-20 OBN - Added check for variable value matching I_S tables
#
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
select @@global.last_insert_id;
select @@session.last_insert_id;
show global variables like 'last_insert_id';
show session variables like 'last_insert_id';
select * from information_schema.global_variables where variable_name='last_insert_id';
select * from information_schema.session_variables where variable_name='last_insert_id';

#
# show that it's writable
#
--error ER_LOCAL_VARIABLE
set global last_insert_id=99;
set session last_insert_id=42;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
select @@global.last_insert_id;
select @@session.last_insert_id;
show global variables like 'last_insert_id';
show session variables like 'last_insert_id';
select * from information_schema.global_variables where variable_name='last_insert_id';
select * from information_schema.session_variables where variable_name='last_insert_id';

#
# incorrect types
#
--error ER_WRONG_TYPE_FOR_VAR
set session last_insert_id=1.1;
--error ER_WRONG_TYPE_FOR_VAR
set session last_insert_id=1e1;
--error ER_WRONG_TYPE_FOR_VAR
set session last_insert_id="foo";