mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV 13679 Enabled sequences to be used in DEFAULT
Other changes done to get this to work: - Added 'internal_tables' to TABLE object to list which sequence tables is needed to use the table. - Mark any expression using DEFAULT() with LEX->default_used. This is needed when deciding if we should open internal sequence tables when a table is opened (we don't need to open sequence tables if the main table is only used with SELECT). - Create_and_open_temporary_table() can now also open all internal sequence tables. - Added option MYSQL_LOCK_USE_MALLOC to mysql_lock_tables() to force memory allocation to be used with malloc instead of memroot. - Added flag to MYSQL_LOCK to remember if allocation was done with malloc or memroot (makes code simpler and safer). - init_one_table_for_prelocking() now takes argument for what lock to use instead of it's a routine or something else. - Renamed prelocking placeholders to make them more understandable as they are now used in more code. - Changed test in check_lock_and_start_stmt() if found table has correct locks. The old test didn't work for tables that has lock TL_WRITE_ALLOW_WRITE, which is what sequence tables are using. - Added VCOL_NOT_VIRTUAL option to ensure that sequence functions can't be used with virtual columns - More sequence tests
This commit is contained in:
@ -1056,6 +1056,35 @@ select next value for s1, cycle_count from s1;
|
||||
next value for s1 cycle_count
|
||||
9223372036854775805 3
|
||||
drop sequence s1;
|
||||
###########################################
|
||||
test default()
|
||||
###########################################
|
||||
connection master;
|
||||
CREATE SEQUENCE s1 nocache engine=myisam;
|
||||
CREATE table t1 (a int default next value for s1, b int);
|
||||
insert into t1 (b) values (1),(2);
|
||||
select default(a) from t1;
|
||||
default(a)
|
||||
3
|
||||
4
|
||||
select * from t1;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
select * from s1;
|
||||
next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
|
||||
5 1 9223372036854775806 1 1 0 0 0
|
||||
connection slave;
|
||||
connection s_normal_3;
|
||||
select * from t1;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
select * from s1;
|
||||
next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
|
||||
5 1 9223372036854775806 1 1 0 0 0
|
||||
connection master;
|
||||
drop table t1,s1;
|
||||
connection master;
|
||||
drop database s_db;
|
||||
drop user normal_1@'%';
|
||||
|
Reference in New Issue
Block a user