mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge mysql.com:/home/gluh/MySQL/Merge/5.0
into mysql.com:/home/gluh/MySQL/Merge/5.0-opt sql/field_conv.cc: Auto merged
This commit is contained in:
@ -705,3 +705,15 @@ use bug21774_1;
|
||||
INSERT INTO bug21774_2.t1 SELECT t1.* FROM t1;
|
||||
DROP DATABASE bug21774_1;
|
||||
DROP DATABASE bug21774_2;
|
||||
USE test;
|
||||
create table t1(f1 int primary key, f2 int);
|
||||
insert into t1 values (1,1);
|
||||
affected rows: 1
|
||||
insert into t1 values (1,1) on duplicate key update f2=1;
|
||||
affected rows: 0
|
||||
insert into t1 values (1,1) on duplicate key update f2=2;
|
||||
affected rows: 2
|
||||
select * from t1;
|
||||
f1 f2
|
||||
1 2
|
||||
drop table t1;
|
||||
|
@ -3728,3 +3728,31 @@ WHERE ID_better=1 AND ID1_with_null IS NULL AND
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref idx1,idx2 idx2 4 const 1 Using where
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a INT, ts TIMESTAMP, KEY ts(ts));
|
||||
INSERT INTO t1 VALUES (30,"2006-01-03 23:00:00"), (31,"2006-01-03 23:00:00");
|
||||
ANALYZE TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status OK
|
||||
CREATE TABLE t2 (a INT, dt1 DATETIME, dt2 DATETIME, PRIMARY KEY (a));
|
||||
INSERT INTO t2 VALUES (30, "2006-01-01 00:00:00", "2999-12-31 00:00:00");
|
||||
INSERT INTO t2 SELECT a+1,dt1,dt2 FROM t2;
|
||||
ANALYZE TABLE t2;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t2 analyze status OK
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30
|
||||
AND t1.ts BETWEEN t2.dt1 AND t2.dt2
|
||||
AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31";
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1
|
||||
1 SIMPLE t1 range ts ts 4 NULL 1 Using where
|
||||
Warnings:
|
||||
Warning 1292 Incorrect datetime value: '2999-12-31 00:00:00' for column 'ts' at row 1
|
||||
SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30
|
||||
AND t1.ts BETWEEN t2.dt1 AND t2.dt2
|
||||
AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31";
|
||||
a ts a dt1 dt2
|
||||
30 2006-01-03 23:00:00 30 2006-01-01 00:00:00 2999-12-31 00:00:00
|
||||
Warnings:
|
||||
Warning 1292 Incorrect datetime value: '2999-12-31 00:00:00' for column 'ts' at row 1
|
||||
DROP TABLE t1,t2;
|
||||
|
@ -377,3 +377,60 @@ create table t1(f1 int, `*f2` int);
|
||||
insert into t1 values (1,1);
|
||||
update t1 set `*f2`=1;
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
request_id int unsigned NOT NULL auto_increment,
|
||||
user_id varchar(12) default NULL,
|
||||
time_stamp datetime NOT NULL default '0000-00-00 00:00:00',
|
||||
ip_address varchar(15) default NULL,
|
||||
PRIMARY KEY (request_id),
|
||||
KEY user_id_2 (user_id,time_stamp)
|
||||
);
|
||||
INSERT INTO t1 (user_id) VALUES ('user1');
|
||||
INSERT INTO t1(user_id) SELECT user_id FROM t1;
|
||||
INSERT INTO t1(user_id) SELECT user_id FROM t1;
|
||||
INSERT INTO t1(user_id) SELECT user_id FROM t1;
|
||||
INSERT INTO t1(user_id) SELECT user_id FROM t1;
|
||||
INSERT INTO t1(user_id) SELECT user_id FROM t1;
|
||||
INSERT INTO t1(user_id) SELECT user_id FROM t1;
|
||||
INSERT INTO t1(user_id) SELECT user_id FROM t1;
|
||||
INSERT INTO t1(user_id) SELECT user_id FROM t1;
|
||||
flush status;
|
||||
SELECT user_id FROM t1 WHERE request_id=9999999999999;
|
||||
user_id
|
||||
show status like '%Handler_read%';
|
||||
Variable_name Value
|
||||
Handler_read_first 0
|
||||
Handler_read_key 1
|
||||
Handler_read_next 0
|
||||
Handler_read_prev 0
|
||||
Handler_read_rnd 0
|
||||
Handler_read_rnd_next 0
|
||||
SELECT user_id FROM t1 WHERE request_id=999999999999999999999999999999;
|
||||
user_id
|
||||
show status like '%Handler_read%';
|
||||
Variable_name Value
|
||||
Handler_read_first 0
|
||||
Handler_read_key 2
|
||||
Handler_read_next 0
|
||||
Handler_read_prev 0
|
||||
Handler_read_rnd 0
|
||||
Handler_read_rnd_next 7
|
||||
UPDATE t1 SET user_id=null WHERE request_id=9999999999999;
|
||||
show status like '%Handler_read%';
|
||||
Variable_name Value
|
||||
Handler_read_first 0
|
||||
Handler_read_key 3
|
||||
Handler_read_next 0
|
||||
Handler_read_prev 0
|
||||
Handler_read_rnd 0
|
||||
Handler_read_rnd_next 14
|
||||
UPDATE t1 SET user_id=null WHERE request_id=999999999999999999999999999999;
|
||||
show status like '%Handler_read%';
|
||||
Variable_name Value
|
||||
Handler_read_first 0
|
||||
Handler_read_key 3
|
||||
Handler_read_next 0
|
||||
Handler_read_prev 0
|
||||
Handler_read_rnd 0
|
||||
Handler_read_rnd_next 21
|
||||
DROP TABLE t1;
|
||||
|
@ -2543,7 +2543,7 @@ create table t1(f1 int, f2 int);
|
||||
create view v1 as select ta.f1 as a, tb.f1 as b from t1 ta, t1 tb where ta.f1=tb
|
||||
.f1 and ta.f2=tb.f2;
|
||||
insert into t1 values(1,1),(2,2);
|
||||
create view v2 as select * from v1 where a > 1 with check option;
|
||||
create view v2 as select * from v1 where a > 1 with local check option;
|
||||
select * from v2;
|
||||
a b
|
||||
2 2
|
||||
@ -3034,4 +3034,48 @@ SHOW CREATE VIEW v1;
|
||||
View Create View
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select _latin1'The\ZEnd' AS `TheEnd`
|
||||
DROP VIEW v1;
|
||||
CREATE TABLE t1 (mydate DATETIME);
|
||||
INSERT INTO t1 VALUES
|
||||
('2007-01-01'), ('2007-01-02'), ('2007-01-30'), ('2007-01-31');
|
||||
CREATE VIEW v1 AS SELECT mydate from t1;
|
||||
SELECT * FROM t1 WHERE mydate BETWEEN '2007-01-01' AND '2007-01-31';
|
||||
mydate
|
||||
2007-01-01 00:00:00
|
||||
2007-01-02 00:00:00
|
||||
2007-01-30 00:00:00
|
||||
2007-01-31 00:00:00
|
||||
SELECT * FROM v1 WHERE mydate BETWEEN '2007-01-01' AND '2007-01-31';
|
||||
mydate
|
||||
2007-01-01 00:00:00
|
||||
2007-01-02 00:00:00
|
||||
2007-01-30 00:00:00
|
||||
2007-01-31 00:00:00
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a int);
|
||||
CREATE TABLE t2 (b int);
|
||||
INSERT INTO t1 VALUES (1), (2);
|
||||
INSERT INTO t2 VALUES (1), (2);
|
||||
CREATE VIEW v1 AS
|
||||
SELECT t2.b FROM t1,t2 WHERE t1.a = t2.b WITH CHECK OPTION;
|
||||
SELECT * FROM v1;
|
||||
b
|
||||
1
|
||||
2
|
||||
UPDATE v1 SET b=3;
|
||||
ERROR HY000: CHECK OPTION failed 'test.v1'
|
||||
SELECT * FROM v1;
|
||||
b
|
||||
1
|
||||
2
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
1
|
||||
2
|
||||
SELECT * FROM t2;
|
||||
b
|
||||
1
|
||||
2
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1,t2;
|
||||
End of 5.0 tests.
|
||||
|
@ -265,4 +265,17 @@ INSERT INTO bug21774_2.t1 SELECT t1.* FROM t1;
|
||||
|
||||
DROP DATABASE bug21774_1;
|
||||
DROP DATABASE bug21774_2;
|
||||
USE test;
|
||||
|
||||
#
|
||||
# Bug#19978: INSERT .. ON DUPLICATE erroneously reports some records were
|
||||
# updated.
|
||||
#
|
||||
create table t1(f1 int primary key, f2 int);
|
||||
--enable_info
|
||||
insert into t1 values (1,1);
|
||||
insert into t1 values (1,1) on duplicate key update f2=1;
|
||||
insert into t1 values (1,1) on duplicate key update f2=2;
|
||||
--disable_info
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
@ -3207,3 +3207,26 @@ EXPLAIN SELECT * FROM t1
|
||||
(ID2_with_null=1 OR ID2_with_null=2);
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #22344: InnoDB keys act strange on datetime vs timestamp comparison
|
||||
#
|
||||
CREATE TABLE t1 (a INT, ts TIMESTAMP, KEY ts(ts));
|
||||
INSERT INTO t1 VALUES (30,"2006-01-03 23:00:00"), (31,"2006-01-03 23:00:00");
|
||||
ANALYZE TABLE t1;
|
||||
|
||||
CREATE TABLE t2 (a INT, dt1 DATETIME, dt2 DATETIME, PRIMARY KEY (a));
|
||||
INSERT INTO t2 VALUES (30, "2006-01-01 00:00:00", "2999-12-31 00:00:00");
|
||||
INSERT INTO t2 SELECT a+1,dt1,dt2 FROM t2;
|
||||
ANALYZE TABLE t2;
|
||||
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30
|
||||
AND t1.ts BETWEEN t2.dt1 AND t2.dt2
|
||||
AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31";
|
||||
|
||||
SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30
|
||||
AND t1.ts BETWEEN t2.dt1 AND t2.dt2
|
||||
AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31";
|
||||
|
||||
DROP TABLE t1,t2;
|
||||
|
@ -307,3 +307,38 @@ insert into t1 values (1,1);
|
||||
update t1 set `*f2`=1;
|
||||
drop table t1;
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Bug #24035: performance degradation with condition int_field=big_decimal
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (
|
||||
request_id int unsigned NOT NULL auto_increment,
|
||||
user_id varchar(12) default NULL,
|
||||
time_stamp datetime NOT NULL default '0000-00-00 00:00:00',
|
||||
ip_address varchar(15) default NULL,
|
||||
PRIMARY KEY (request_id),
|
||||
KEY user_id_2 (user_id,time_stamp)
|
||||
);
|
||||
|
||||
INSERT INTO t1 (user_id) VALUES ('user1');
|
||||
INSERT INTO t1(user_id) SELECT user_id FROM t1;
|
||||
INSERT INTO t1(user_id) SELECT user_id FROM t1;
|
||||
INSERT INTO t1(user_id) SELECT user_id FROM t1;
|
||||
INSERT INTO t1(user_id) SELECT user_id FROM t1;
|
||||
INSERT INTO t1(user_id) SELECT user_id FROM t1;
|
||||
INSERT INTO t1(user_id) SELECT user_id FROM t1;
|
||||
INSERT INTO t1(user_id) SELECT user_id FROM t1;
|
||||
INSERT INTO t1(user_id) SELECT user_id FROM t1;
|
||||
|
||||
flush status;
|
||||
SELECT user_id FROM t1 WHERE request_id=9999999999999;
|
||||
show status like '%Handler_read%';
|
||||
SELECT user_id FROM t1 WHERE request_id=999999999999999999999999999999;
|
||||
show status like '%Handler_read%';
|
||||
UPDATE t1 SET user_id=null WHERE request_id=9999999999999;
|
||||
show status like '%Handler_read%';
|
||||
UPDATE t1 SET user_id=null WHERE request_id=999999999999999999999999999999;
|
||||
show status like '%Handler_read%';
|
||||
|
||||
DROP TABLE t1;
|
||||
|
@ -2385,7 +2385,7 @@ create table t1(f1 int, f2 int);
|
||||
create view v1 as select ta.f1 as a, tb.f1 as b from t1 ta, t1 tb where ta.f1=tb
|
||||
.f1 and ta.f2=tb.f2;
|
||||
insert into t1 values(1,1),(2,2);
|
||||
create view v2 as select * from v1 where a > 1 with check option;
|
||||
create view v2 as select * from v1 where a > 1 with local check option;
|
||||
select * from v2;
|
||||
update v2 set b=3 where a=2;
|
||||
select * from v2;
|
||||
@ -2986,4 +2986,42 @@ SHOW CREATE VIEW v1;
|
||||
|
||||
DROP VIEW v1;
|
||||
|
||||
#
|
||||
# Bug #26124: BETWEEN over a view column of the DATETIME type
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (mydate DATETIME);
|
||||
INSERT INTO t1 VALUES
|
||||
('2007-01-01'), ('2007-01-02'), ('2007-01-30'), ('2007-01-31');
|
||||
|
||||
CREATE VIEW v1 AS SELECT mydate from t1;
|
||||
|
||||
SELECT * FROM t1 WHERE mydate BETWEEN '2007-01-01' AND '2007-01-31';
|
||||
SELECT * FROM v1 WHERE mydate BETWEEN '2007-01-01' AND '2007-01-31';
|
||||
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #25931: update of a multi-table view with check option
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a int);
|
||||
CREATE TABLE t2 (b int);
|
||||
INSERT INTO t1 VALUES (1), (2);
|
||||
INSERT INTO t2 VALUES (1), (2);
|
||||
|
||||
CREATE VIEW v1 AS
|
||||
SELECT t2.b FROM t1,t2 WHERE t1.a = t2.b WITH CHECK OPTION;
|
||||
|
||||
SELECT * FROM v1;
|
||||
--error 1369
|
||||
UPDATE v1 SET b=3;
|
||||
SELECT * FROM v1;
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
--echo End of 5.0 tests.
|
||||
|
Reference in New Issue
Block a user