mirror of
https://github.com/MariaDB/server.git
synced 2025-01-20 22:12:30 +01:00
89a208850a
Default values of variables were not subject to upper/lower bounds and step, while setting variables was. Bounds and step are also applied to defaults now; defaults are corrected quietly, values given by the user are corrected, and a correction-warning is thrown as needed. Lastly, very large values could wrap around, starting from 0 again. They are bounded at the maximum value for the respective data-type now if no lower maximum is specified in the variable's definition. client/mysql.cc: correct maxima in options array client/mysqltest.c: adjust minimum for "sleep" option so default value is no longer out of bounds. include/m_string.h: ullstr() - the unsigned brother of llstr() include/my_getopt.h: Flag if we bounded the value (that is, correct anything aside from making value a multiple of block-size) mysql-test/r/delayed.result: We throw a warning now when we adjust out of range parameters. mysql-test/r/index_merge.result: We throw a warning now when we adjust out of range parameters. mysql-test/r/innodb.result: We throw a warning now when we adjust out of range parameters. mysql-test/r/innodb_mysql.result: We throw a warning now when we adjust out of range parameters. mysql-test/r/key_cache.result: We throw a warning now when we adjust out of range parameters. mysql-test/r/packet.result: We throw a warning now when we adjust out of range parameters. mysql-test/r/ps.result: We throw a warning now when we adjust out of range parameters. mysql-test/r/subselect.result: We throw a warning now when we adjust out of range parameters. mysql-test/r/type_bit.result: We throw a warning now when we adjust out of range parameters. mysql-test/r/type_bit_innodb.result: We throw a warning now when we adjust out of range parameters. mysql-test/r/variables.result: correct results: bounds and step apply to variables' default values, too mysql-test/t/variables.test: correct results: bounds and step apply to variables' default values, too mysys/my_getopt.c: - apply bounds/step to default values of variables (based on work by serg) - print complaints about incorrect values for variables (truncation etc., by requestion of consulting) - if no lower maximum is specified in variable definition, bound unsigned values at their maximum to prevent wrap-around - some calls to error_reporter had a \n, some didn't. remove \n from calls, let reporter-function handle it, so the default reporter behaves like that in mysqld sql/mysql_priv.h: correct RANGE_ALLOC_BLOCK_SIZE (cleared with monty) sql/mysqld.cc: correct maxima to correct data-type. correct minima where higher than default. correct range-alloc-block-size. correct inno variables so GET_* corresponds to actual variable's type. sql/set_var.cc: When the new value for a variable is out of bounds, we'll send the client a warning (but not if the value was simply not a multiple of 'blocksize'). sys_var_thd_ulong had this, sys_var_long_ptr_global didn't; broken out and streamlined to avoid duplication of code. strings/llstr.c: ullstr() - the unsigned brother of llstr()
273 lines
6.8 KiB
Text
273 lines
6.8 KiB
Text
drop table if exists t1;
|
|
create table t1 (a char(10), tmsp timestamp);
|
|
insert into t1 set a = 1;
|
|
insert delayed into t1 set a = 2;
|
|
insert into t1 set a = 3, tmsp=NULL;
|
|
insert delayed into t1 set a = 4;
|
|
insert delayed into t1 set a = 5, tmsp = 19711006010203;
|
|
insert delayed into t1 (a, tmsp) values (6, 19711006010203);
|
|
insert delayed into t1 (a, tmsp) values (7, NULL);
|
|
FLUSH TABLE t1;
|
|
insert into t1 set a = 8,tmsp=19711006010203;
|
|
select * from t1 where tmsp=0;
|
|
a tmsp
|
|
select * from t1 where tmsp=19711006010203;
|
|
a tmsp
|
|
5 1971-10-06 01:02:03
|
|
6 1971-10-06 01:02:03
|
|
8 1971-10-06 01:02:03
|
|
drop table t1;
|
|
create table t1 (a int not null auto_increment primary key, b char(10));
|
|
insert delayed into t1 values (1,"b");
|
|
insert delayed into t1 values (null,"c");
|
|
insert delayed into t1 values (3,"d"),(null,"e");
|
|
insert delayed into t1 values (3,"this will give an","error");
|
|
ERROR 21S01: Column count doesn't match value count at row 1
|
|
FLUSH TABLE t1;
|
|
show status like 'not_flushed_delayed_rows';
|
|
Variable_name Value
|
|
Not_flushed_delayed_rows 0
|
|
select * from t1;
|
|
a b
|
|
1 b
|
|
2 c
|
|
3 d
|
|
4 e
|
|
drop table t1;
|
|
create table t1 (a int not null primary key);
|
|
insert into t1 values (1);
|
|
insert delayed into t1 values (1);
|
|
select * from t1;
|
|
a
|
|
1
|
|
drop table t1;
|
|
CREATE TABLE t1 ( a int(10) NOT NULL auto_increment, PRIMARY KEY (a));
|
|
insert delayed into t1 values(null);
|
|
insert into t1 values(null);
|
|
insert into t1 values(null);
|
|
insert delayed into t1 values(null);
|
|
insert delayed into t1 values(null);
|
|
insert delayed into t1 values(null);
|
|
insert into t1 values(null);
|
|
insert into t1 values(null);
|
|
insert into t1 values(null);
|
|
delete from t1 where a=6;
|
|
insert delayed into t1 values(null);
|
|
insert delayed into t1 values(null);
|
|
insert delayed into t1 values(null);
|
|
insert delayed into t1 values(null);
|
|
FLUSH TABLE t1;
|
|
select * from t1 order by a;
|
|
a
|
|
1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
7
|
|
8
|
|
9
|
|
10
|
|
11
|
|
12
|
|
13
|
|
DROP TABLE t1;
|
|
SET @bug20627_old_auto_increment_offset=
|
|
@@auto_increment_offset= 2;
|
|
SET @bug20627_old_auto_increment_increment=
|
|
@@auto_increment_increment= 3;
|
|
SET @bug20627_old_session_auto_increment_offset=
|
|
@@session.auto_increment_offset= 4;
|
|
SET @bug20627_old_session_auto_increment_increment=
|
|
@@session.auto_increment_increment= 5;
|
|
SET @@auto_increment_offset= 2;
|
|
SET @@auto_increment_increment= 3;
|
|
SET @@session.auto_increment_offset= 4;
|
|
SET @@session.auto_increment_increment= 5;
|
|
CREATE TABLE t1 (
|
|
c1 INT NOT NULL AUTO_INCREMENT,
|
|
PRIMARY KEY (c1)
|
|
);
|
|
INSERT INTO t1 VALUES (NULL),(NULL),(NULL);
|
|
SELECT * FROM t1;
|
|
c1
|
|
4
|
|
9
|
|
14
|
|
DROP TABLE t1;
|
|
CREATE TABLE t1 (
|
|
c1 INT NOT NULL AUTO_INCREMENT,
|
|
PRIMARY KEY (c1)
|
|
);
|
|
INSERT DELAYED INTO t1 VALUES (NULL),(NULL),(NULL);
|
|
FLUSH TABLE t1;
|
|
SELECT * FROM t1;
|
|
c1
|
|
4
|
|
9
|
|
14
|
|
DROP TABLE t1;
|
|
SET @@auto_increment_offset=
|
|
@bug20627_old_auto_increment_offset;
|
|
Warnings:
|
|
Warning 1292 Truncated incorrect auto-increment-offset value: '0'
|
|
SET @@auto_increment_increment=
|
|
@bug20627_old_auto_increment_increment;
|
|
Warnings:
|
|
Warning 1292 Truncated incorrect auto-increment-increment value: '0'
|
|
SET @@session.auto_increment_offset=
|
|
@bug20627_old_session_auto_increment_offset;
|
|
Warnings:
|
|
Warning 1292 Truncated incorrect auto-increment-offset value: '0'
|
|
SET @@session.auto_increment_increment=
|
|
@bug20627_old_session_auto_increment_increment;
|
|
Warnings:
|
|
Warning 1292 Truncated incorrect auto-increment-increment value: '0'
|
|
SET @bug20830_old_auto_increment_offset=
|
|
@@auto_increment_offset= 2;
|
|
SET @bug20830_old_auto_increment_increment=
|
|
@@auto_increment_increment= 3;
|
|
SET @bug20830_old_session_auto_increment_offset=
|
|
@@session.auto_increment_offset= 4;
|
|
SET @bug20830_old_session_auto_increment_increment=
|
|
@@session.auto_increment_increment= 5;
|
|
SET @@auto_increment_offset= 2;
|
|
SET @@auto_increment_increment= 3;
|
|
SET @@session.auto_increment_offset= 4;
|
|
SET @@session.auto_increment_increment= 5;
|
|
CREATE TABLE t1 (
|
|
c1 INT(11) NOT NULL AUTO_INCREMENT,
|
|
c2 INT(11) DEFAULT NULL,
|
|
PRIMARY KEY (c1)
|
|
);
|
|
SET insert_id= 14;
|
|
INSERT INTO t1 VALUES(NULL, 11), (NULL, 12), (NULL, 13);
|
|
INSERT INTO t1 VALUES(NULL, 21), (NULL, 22), (NULL, 23);
|
|
INSERT INTO t1 VALUES( 69, 31), (NULL, 32), (NULL, 33);
|
|
INSERT INTO t1 VALUES(NULL, 41), (NULL, 42), (NULL, 43);
|
|
SET insert_id= 114;
|
|
INSERT INTO t1 VALUES(NULL, 51), (NULL, 52), (NULL, 53);
|
|
INSERT INTO t1 VALUES(NULL, 61), (NULL, 62), (NULL, 63);
|
|
INSERT INTO t1 VALUES( 49, 71), (NULL, 72), (NULL, 73);
|
|
INSERT INTO t1 VALUES(NULL, 81), (NULL, 82), (NULL, 83);
|
|
SET insert_id= 114;
|
|
INSERT INTO t1 VALUES(NULL, 91);
|
|
ERROR 23000: Duplicate entry '114' for key 1
|
|
INSERT INTO t1 VALUES (NULL, 92), (NULL, 93);
|
|
SELECT * FROM t1;
|
|
c1 c2
|
|
14 11
|
|
19 12
|
|
24 13
|
|
29 21
|
|
34 22
|
|
39 23
|
|
69 31
|
|
74 32
|
|
79 33
|
|
84 41
|
|
89 42
|
|
94 43
|
|
114 51
|
|
119 52
|
|
124 53
|
|
129 61
|
|
134 62
|
|
139 63
|
|
49 71
|
|
144 72
|
|
149 73
|
|
154 81
|
|
159 82
|
|
164 83
|
|
169 92
|
|
174 93
|
|
SELECT COUNT(*) FROM t1;
|
|
COUNT(*)
|
|
26
|
|
SELECT SUM(c1) FROM t1;
|
|
SUM(c1)
|
|
2569
|
|
DROP TABLE t1;
|
|
CREATE TABLE t1 (
|
|
c1 INT(11) NOT NULL AUTO_INCREMENT,
|
|
c2 INT(11) DEFAULT NULL,
|
|
PRIMARY KEY (c1)
|
|
);
|
|
SET insert_id= 14;
|
|
INSERT DELAYED INTO t1 VALUES(NULL, 11), (NULL, 12), (NULL, 13);
|
|
INSERT DELAYED INTO t1 VALUES(NULL, 21), (NULL, 22), (NULL, 23);
|
|
INSERT DELAYED INTO t1 VALUES( 69, 31), (NULL, 32), (NULL, 33);
|
|
INSERT DELAYED INTO t1 VALUES(NULL, 41), (NULL, 42), (NULL, 43);
|
|
SET insert_id= 114;
|
|
INSERT DELAYED INTO t1 VALUES(NULL, 51), (NULL, 52), (NULL, 53);
|
|
INSERT DELAYED INTO t1 VALUES(NULL, 61), (NULL, 62), (NULL, 63);
|
|
INSERT DELAYED INTO t1 VALUES( 49, 71), (NULL, 72), (NULL, 73);
|
|
INSERT DELAYED INTO t1 VALUES(NULL, 81), (NULL, 82), (NULL, 83);
|
|
SET insert_id= 114;
|
|
INSERT DELAYED INTO t1 VALUES(NULL, 91);
|
|
INSERT DELAYED INTO t1 VALUES (NULL, 92), (NULL, 93);
|
|
FLUSH TABLE t1;
|
|
SELECT * FROM t1;
|
|
c1 c2
|
|
14 11
|
|
19 12
|
|
24 13
|
|
29 21
|
|
34 22
|
|
39 23
|
|
69 31
|
|
74 32
|
|
79 33
|
|
84 41
|
|
89 42
|
|
94 43
|
|
114 51
|
|
119 52
|
|
124 53
|
|
129 61
|
|
134 62
|
|
139 63
|
|
49 71
|
|
144 72
|
|
149 73
|
|
154 81
|
|
159 82
|
|
164 83
|
|
169 92
|
|
174 93
|
|
SELECT COUNT(*) FROM t1;
|
|
COUNT(*)
|
|
26
|
|
SELECT SUM(c1) FROM t1;
|
|
SUM(c1)
|
|
2569
|
|
DROP TABLE t1;
|
|
SET @@auto_increment_offset=
|
|
@bug20830_old_auto_increment_offset;
|
|
Warnings:
|
|
Warning 1292 Truncated incorrect auto-increment-offset value: '0'
|
|
SET @@auto_increment_increment=
|
|
@bug20830_old_auto_increment_increment;
|
|
Warnings:
|
|
Warning 1292 Truncated incorrect auto-increment-increment value: '0'
|
|
SET @@session.auto_increment_offset=
|
|
@bug20830_old_session_auto_increment_offset;
|
|
Warnings:
|
|
Warning 1292 Truncated incorrect auto-increment-offset value: '0'
|
|
SET @@session.auto_increment_increment=
|
|
@bug20830_old_session_auto_increment_increment;
|
|
Warnings:
|
|
Warning 1292 Truncated incorrect auto-increment-increment value: '0'
|
|
CREATE TABLE t1(a BIT);
|
|
INSERT DELAYED INTO t1 VALUES(1);
|
|
FLUSH TABLE t1;
|
|
SELECT HEX(a) FROM t1;
|
|
HEX(a)
|
|
1
|
|
DROP TABLE t1;
|
|
CREATE TABLE t1(c1 INT) ENGINE=MyISAM;
|
|
CREATE TABLE t2(c1 INT) ENGINE=MERGE UNION=(t1);
|
|
INSERT DELAYED INTO t2 VALUES(1);
|
|
ERROR HY000: Table storage engine for 't2' doesn't have this option
|
|
DROP TABLE t1, t2;
|