Commit c5677d9a authored by unknown's avatar unknown
Browse files

Merge paul@bk-internal.mysql.com:/home/bk/mysql-4.1

into ice.snake.net:/Volumes/ice2/MySQL/bk/mysql-4.1

parents 14f8afc9 5803d603
Loading
Loading
Loading
Loading
+36 −0
Original line number Diff line number Diff line
@@ -271,3 +271,39 @@ i i COUNT(*)
100	NULL	2
NULL	NULL	2
drop table t1,t2;
CREATE TABLE user_day(
user_id INT NOT NULL,
date DATE NOT NULL,
UNIQUE INDEX user_date (user_id, date)
);
INSERT INTO user_day VALUES
(1, '2004-06-06' ),
(1, '2004-06-07' ),
(2, '2004-06-06' );
SELECT
d.date AS day,
COUNT(d.user_id) as sample,
COUNT(next_day.user_id) AS not_cancelled
FROM user_day d
LEFT JOIN user_day next_day 
ON next_day.user_id=d.user_id AND 
next_day.date= DATE_ADD( d.date, interval 1 day )
GROUP BY day;
day	sample	not_cancelled
2004-06-06	2	1
2004-06-07	1	0
SELECT
d.date AS day,
COUNT(d.user_id) as sample,
COUNT(next_day.user_id) AS not_cancelled
FROM user_day d
LEFT JOIN user_day next_day 
ON next_day.user_id=d.user_id AND 
next_day.date= DATE_ADD( d.date, interval 1 day )
GROUP BY day
WITH ROLLUP;
day	sample	not_cancelled
2004-06-06	2	1
2004-06-07	1	0
NULL	3	1
DROP TABLE user_day;
+7 −0
Original line number Diff line number Diff line
@@ -219,3 +219,10 @@ Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length I
t1	MyISAM	9	Dynamic	0	0	0	4294967295	1024	0	NULL	#	#	#	latin1_swedish_ci	NULL		
deallocate prepare stmt1 ;
drop table t1;
create table t1(a varchar(2), b varchar(3));
prepare stmt1 from "select a, b from t1 where (not (a='aa' and b < 'zzz'))";
execute stmt1;
a	b
execute stmt1;
a	b
deallocate prepare stmt1;
+1 −1
Original line number Diff line number Diff line
--innodb_lock_wait_timeout=5
--loose-innodb_lock_wait_timeout=5
+37 −0
Original line number Diff line number Diff line
@@ -88,3 +88,40 @@ INSERT INTO t2 VALUES (100),(200);
SELECT i, COUNT(*) FROM t1 GROUP BY i WITH ROLLUP;
SELECT t1.i, t2.i, COUNT(*) FROM t1,t2 GROUP BY t1.i,t2.i WITH ROLLUP;
drop table t1,t2;

#bug #4767: ROLLUP with LEFT JOIN 

CREATE TABLE user_day(
  user_id INT NOT NULL,
  date DATE NOT NULL,
  UNIQUE INDEX user_date (user_id, date)
);

INSERT INTO user_day VALUES
  (1, '2004-06-06' ),
  (1, '2004-06-07' ),
  (2, '2004-06-06' );

SELECT
       d.date AS day,
       COUNT(d.user_id) as sample,
       COUNT(next_day.user_id) AS not_cancelled
  FROM user_day d
       LEFT JOIN user_day next_day 
       ON next_day.user_id=d.user_id AND 
          next_day.date= DATE_ADD( d.date, interval 1 day )
  GROUP BY day;

SELECT
       d.date AS day,
       COUNT(d.user_id) as sample,
       COUNT(next_day.user_id) AS not_cancelled
  FROM user_day d
       LEFT JOIN user_day next_day 
       ON next_day.user_id=d.user_id AND 
          next_day.date= DATE_ADD( d.date, interval 1 day )
  GROUP BY day
    WITH ROLLUP;

DROP TABLE user_day;
+12 −0
Original line number Diff line number Diff line
@@ -206,3 +206,15 @@ execute stmt1;
show table status from test like 't1%' ;
deallocate prepare stmt1 ;
drop table t1;

#
# Bug#4912 "mysqld crashs in case a statement is executed a second time":
# negation elimination should and prepared statemens
# 

create table t1(a varchar(2), b varchar(3));
prepare stmt1 from "select a, b from t1 where (not (a='aa' and b < 'zzz'))";
execute stmt1;
execute stmt1;
deallocate prepare stmt1;
Loading