Commit 6f5baa1e authored by monty@mysql.com's avatar monty@mysql.com

Merge mysql.com:/home/my/mysql-4.1

into  mysql.com:/home/my/mysql-5.0
parents 1436494a 829a4831
drop table if exists t1,t2,t3,t4; drop table if exists t1,t2,t3,t4,t11;
drop table if exists t1_1,t1_2,t9_1,t9_2,t1aa,t2aa; drop table if exists t1_1,t1_2,t9_1,t9_2,t1aa,t2aa;
drop view if exists v1; drop view if exists v1;
CREATE TABLE t1 ( CREATE TABLE t1 (
...@@ -2656,6 +2656,51 @@ t11 MyISAM 10 Dynamic 0 0 X X X X X X X X latin1_swedish_ci NULL ...@@ -2656,6 +2656,51 @@ t11 MyISAM 10 Dynamic 0 0 X X X X X X X X latin1_swedish_ci NULL
select 123 as a from t1 where f1 is null; select 123 as a from t1 where f1 is null;
a a
drop table t1,t11; drop table t1,t11;
CREATE TABLE t1 (a INT, b INT);
(SELECT a, b AS c FROM t1) ORDER BY c+1;
a c
(SELECT a, b AS c FROM t1) ORDER BY b+1;
a c
SELECT a, b AS c FROM t1 ORDER BY c+1;
a c
SELECT a, b AS c FROM t1 ORDER BY b+1;
a c
drop table t1;
CREATE TABLE t1 ( a INT NOT NULL, b INT NOT NULL, UNIQUE idx (a,b) );
INSERT INTO t1 VALUES (1,1),(1,2),(1,3),(1,4);
CREATE TABLE t2 ( a INT NOT NULL, b INT NOT NULL, c INT );
INSERT INTO t2 VALUES ( 1,10,1), (1,10,2), (1,11,1), (1,11,2), (1,2,1), (1,2,2),
(1,2,3);
SELECT t2.a, t2.b, IF(t1.b IS NULL,'',c) AS c, COUNT(*) AS d FROM t2 LEFT JOIN
t1 ON t2.a = t1.a AND t2.b = t1.b GROUP BY a, b, c;
a b c d
1 2 1 1
1 2 2 1
1 2 3 1
1 10 2
1 11 2
SELECT t2.a, t2.b, IF(t1.b IS NULL,'',c) AS c, COUNT(*) AS d FROM t2 LEFT JOIN
t1 ON t2.a = t1.a AND t2.b = t1.b GROUP BY t1.a, t1.b, c;
a b c d
1 10 4
1 2 1 1
1 2 2 1
1 2 3 1
SELECT t2.a, t2.b, IF(t1.b IS NULL,'',c) AS c, COUNT(*) AS d FROM t2 LEFT JOIN
t1 ON t2.a = t1.a AND t2.b = t1.b GROUP BY t2.a, t2.b, c;
a b c d
1 2 1 1
1 2 2 1
1 2 3 1
1 10 2
1 11 2
SELECT t2.a, t2.b, IF(t1.b IS NULL,'',c) AS c, COUNT(*) AS d FROM t2,t1
WHERE t2.a = t1.a AND t2.b = t1.b GROUP BY a, b, c;
a b c d
1 2 1 1
1 2 2 1
1 2 3 1
DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 ( city char(30) ); CREATE TABLE t1 ( city char(30) );
INSERT INTO t1 VALUES ('London'); INSERT INTO t1 VALUES ('London');
INSERT INTO t1 VALUES ('Paris'); INSERT INTO t1 VALUES ('Paris');
...@@ -3065,26 +3110,18 @@ id ...@@ -3065,26 +3110,18 @@ id
102 102
drop table t1, t2; drop table t1, t2;
drop view v1, v2, v3; drop view v1, v2, v3;
create table a ( create table t1 (id int(11) not null default '0');
id int(11) not null default '0' insert into t1 values (123),(191),(192);
) engine=myisam default charset=latin1; create table t2 (id char(16) character set utf8 not null);
insert into a values (123),(191),(192); insert into t2 values ('58013'),('58014'),('58015'),('58016');
create table b ( create table t3 (a_id int(11) not null, b_id char(16) character set utf8);
id char(16) character set utf8 not null default '' insert into t3 values (123,null),(123,null),(123,null),(123,null),(123,null),(123,'58013');
) engine=myisam default charset=latin1;
insert into b values ('58013'),('58014'),('58015'),('58016');
create table c (
a_id int(11) not null default '0',
b_id char(16) character set utf8 default null
) engine=myisam default charset=latin1;
insert into c values
(123,null),(123,null),(123,null),(123,null),(123,null),(123,'58013');
select count(*) select count(*)
from a inner join (c left join b on b.id = c.b_id) on a.id = c.a_id; from t1 inner join (t3 left join t2 on t2.id = t3.b_id) on t1.id = t3.a_id;
count(*) count(*)
6 6
select count(*) select count(*)
from a inner join (b right join c on b.id = c.b_id) on a.id = c.a_id; from t1 inner join (t2 right join t3 on t2.id = t3.b_id) on t1.id = t3.a_id;
count(*) count(*)
6 6
drop table a, b, c; drop table t1,t2,t3;
...@@ -2216,6 +2216,35 @@ insert into t1 values(1,""),(2,""); ...@@ -2216,6 +2216,35 @@ insert into t1 values(1,""),(2,"");
show table status like 't1%'; show table status like 't1%';
select 123 as a from t1 where f1 is null; select 123 as a from t1 where f1 is null;
drop table t1,t11; drop table t1,t11;
# Bug 7672 Unknown column error in order clause
#
CREATE TABLE t1 (a INT, b INT);
(SELECT a, b AS c FROM t1) ORDER BY c+1;
(SELECT a, b AS c FROM t1) ORDER BY b+1;
SELECT a, b AS c FROM t1 ORDER BY c+1;
SELECT a, b AS c FROM t1 ORDER BY b+1;
drop table t1;
#
# Bug #3874 (function in GROUP and LEFT JOIN)
#
CREATE TABLE t1 ( a INT NOT NULL, b INT NOT NULL, UNIQUE idx (a,b) );
INSERT INTO t1 VALUES (1,1),(1,2),(1,3),(1,4);
CREATE TABLE t2 ( a INT NOT NULL, b INT NOT NULL, c INT );
INSERT INTO t2 VALUES ( 1,10,1), (1,10,2), (1,11,1), (1,11,2), (1,2,1), (1,2,2),
(1,2,3);
SELECT t2.a, t2.b, IF(t1.b IS NULL,'',c) AS c, COUNT(*) AS d FROM t2 LEFT JOIN
t1 ON t2.a = t1.a AND t2.b = t1.b GROUP BY a, b, c;
SELECT t2.a, t2.b, IF(t1.b IS NULL,'',c) AS c, COUNT(*) AS d FROM t2 LEFT JOIN
t1 ON t2.a = t1.a AND t2.b = t1.b GROUP BY t1.a, t1.b, c;
SELECT t2.a, t2.b, IF(t1.b IS NULL,'',c) AS c, COUNT(*) AS d FROM t2 LEFT JOIN
t1 ON t2.a = t1.a AND t2.b = t1.b GROUP BY t2.a, t2.b, c;
SELECT t2.a, t2.b, IF(t1.b IS NULL,'',c) AS c, COUNT(*) AS d FROM t2,t1
WHERE t2.a = t1.a AND t2.b = t1.b GROUP BY a, b, c;
DROP TABLE IF EXISTS t1, t2;
# End of 4.1 tests # End of 4.1 tests
# #
......
...@@ -4844,7 +4844,8 @@ Log_event* next_event(RELAY_LOG_INFO* rli) ...@@ -4844,7 +4844,8 @@ Log_event* next_event(RELAY_LOG_INFO* rli)
time_t save_timestamp= rli->last_master_timestamp; time_t save_timestamp= rli->last_master_timestamp;
rli->last_master_timestamp= 0; rli->last_master_timestamp= 0;
DBUG_ASSERT(rli->relay_log.get_open_count() == rli->cur_log_old_open_count); DBUG_ASSERT(rli->relay_log.get_open_count() ==
rli->cur_log_old_open_count);
if (rli->ign_master_log_name_end[0]) if (rli->ign_master_log_name_end[0])
{ {
...@@ -4854,13 +4855,13 @@ Log_event* next_event(RELAY_LOG_INFO* rli) ...@@ -4854,13 +4855,13 @@ Log_event* next_event(RELAY_LOG_INFO* rli)
0, rli->ign_master_log_pos_end, 0, rli->ign_master_log_pos_end,
Rotate_log_event::DUP_NAME); Rotate_log_event::DUP_NAME);
rli->ign_master_log_name_end[0]= 0; rli->ign_master_log_name_end[0]= 0;
pthread_mutex_unlock(log_lock);
if (unlikely(!ev)) if (unlikely(!ev))
{ {
errmsg= "Slave SQL thread failed to create a Rotate event " errmsg= "Slave SQL thread failed to create a Rotate event "
"(out of memory?), SHOW SLAVE STATUS may be inaccurate"; "(out of memory?), SHOW SLAVE STATUS may be inaccurate";
goto err; goto err;
} }
pthread_mutex_unlock(log_lock);
ev->server_id= 0; // don't be ignored by slave SQL thread ev->server_id= 0; // don't be ignored by slave SQL thread
DBUG_RETURN(ev); DBUG_RETURN(ev);
} }
......
...@@ -5906,7 +5906,7 @@ eq_ref_table(JOIN *join, ORDER *start_order, JOIN_TAB *tab) ...@@ -5906,7 +5906,7 @@ eq_ref_table(JOIN *join, ORDER *start_order, JOIN_TAB *tab)
tab->cached_eq_ref_table=1; tab->cached_eq_ref_table=1;
if (tab->type == JT_CONST) // We can skip const tables if (tab->type == JT_CONST) // We can skip const tables
return (tab->eq_ref_table=1); /* purecov: inspected */ return (tab->eq_ref_table=1); /* purecov: inspected */
if (tab->type != JT_EQ_REF) if (tab->type != JT_EQ_REF || tab->table->maybe_null)
return (tab->eq_ref_table=0); // We must use this return (tab->eq_ref_table=0); // We must use this
Item **ref_item=tab->ref.items; Item **ref_item=tab->ref.items;
Item **end=ref_item+tab->ref.key_parts; Item **end=ref_item+tab->ref.key_parts;
......
...@@ -159,7 +159,7 @@ Vio *vio_new(my_socket sd, enum enum_vio_type type, uint flags) ...@@ -159,7 +159,7 @@ Vio *vio_new(my_socket sd, enum enum_vio_type type, uint flags)
reports that the socket is set for non-blocking when it really will reports that the socket is set for non-blocking when it really will
block. block.
*/ */
fcntl(sd, F_SETFL, vio->fcntl_mode); fcntl(sd, F_SETFL, 0);
vio->fcntl_mode= fcntl(sd, F_GETFL); vio->fcntl_mode= fcntl(sd, F_GETFL);
#elif defined(HAVE_SYS_IOCTL_H) /* hpux */ #elif defined(HAVE_SYS_IOCTL_H) /* hpux */
/* Non blocking sockets doesn't work good on HPUX 11.0 */ /* Non blocking sockets doesn't work good on HPUX 11.0 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment