mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge pgalbraith@bk-internal.mysql.com:/home/bk/mysql-5.0
into radha.local:/Users/patg/mysql-build/mysql-5.0.bug9056
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
drop table if exists t1,t2;
|
||||
show tables;
|
||||
Tables_in_mysql
|
||||
columns_priv
|
||||
@ -71,3 +72,8 @@ show tables;
|
||||
Tables_in_test
|
||||
delete from mysql.user where user=_binary"test";
|
||||
flush privileges;
|
||||
create table t1 (id integer not null auto_increment primary key);
|
||||
create temporary table t2(id integer not null auto_increment primary key);
|
||||
set @id := 1;
|
||||
delete from t1 where id like @id;
|
||||
drop table t1;
|
||||
|
@ -766,6 +766,15 @@ n
|
||||
Warnings:
|
||||
Warning 1052 Column 'n' in group statement is ambiguous
|
||||
DROP TABLE t1;
|
||||
create table t1(f1 varchar(5) key);
|
||||
insert into t1 values (1),(2);
|
||||
select sql_buffer_result max(f1) is null from t1;
|
||||
max(f1) is null
|
||||
0
|
||||
select sql_buffer_result max(f1)+1 from t1;
|
||||
max(f1)+1
|
||||
3
|
||||
drop table t1;
|
||||
create table t1 (c1 char(3), c2 char(3));
|
||||
create table t2 (c3 char(3), c4 char(3));
|
||||
insert into t1 values ('aaa', 'bb1'), ('aaa', 'bb2');
|
||||
|
@ -555,6 +555,31 @@ IFNULL(a, 'TEST') COALESCE(b, 'TEST')
|
||||
4 TEST
|
||||
TEST TEST
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (a INT(10) NOT NULL, b INT(10) NOT NULL);
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
INSERT INTO t1 VALUES (1, 2);
|
||||
SELECT a, b, a AS c, COUNT(*) AS count FROM t1 GROUP BY a, b, c WITH ROLLUP;
|
||||
a b c count
|
||||
1 1 1 1
|
||||
1 1 NULL 1
|
||||
1 2 1 1
|
||||
1 2 NULL 1
|
||||
1 NULL NULL 2
|
||||
NULL NULL NULL 2
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a int(11) NOT NULL);
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
SELECT * FROM (SELECT a, a + 1, COUNT(*) FROM t1 GROUP BY a WITH ROLLUP) t;
|
||||
a a + 1 COUNT(*)
|
||||
1 2 1
|
||||
2 3 1
|
||||
NULL NULL 2
|
||||
SELECT * FROM (SELECT a, LENGTH(a), COUNT(*) FROM t1 GROUP BY a WITH ROLLUP) t;
|
||||
a LENGTH(a) COUNT(*)
|
||||
1 1 1
|
||||
2 1 1
|
||||
NULL NULL 2
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(id int, type char(1));
|
||||
INSERT INTO t1 VALUES
|
||||
(1,"A"),(2,"C"),(3,"A"),(4,"A"),(5,"B"),
|
||||
@ -577,15 +602,19 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 10 Using filesort
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a INT(10) NOT NULL, b INT(10) NOT NULL);
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
INSERT INTO t1 VALUES (1, 2);
|
||||
SELECT a, b, a AS c, COUNT(*) AS count FROM t1 GROUP BY a, b, c WITH ROLLUP;
|
||||
a b c count
|
||||
1 1 1 1
|
||||
1 1 NULL 1
|
||||
1 2 1 1
|
||||
1 2 NULL 1
|
||||
1 NULL NULL 2
|
||||
NULL NULL NULL 2
|
||||
CREATE TABLE t1 (a int(11) NOT NULL);
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
CREATE VIEW v1 AS
|
||||
SELECT a, LENGTH(a), COUNT(*) FROM t1 GROUP BY a WITH ROLLUP;
|
||||
DESC v1;
|
||||
Field Type Null Key Default Extra
|
||||
a bigint(11) YES NULL
|
||||
LENGTH(a) bigint(10) YES NULL
|
||||
COUNT(*) bigint(21) NO 0
|
||||
SELECT * FROM v1;
|
||||
a LENGTH(a) COUNT(*)
|
||||
1 1 1
|
||||
2 1 1
|
||||
NULL NULL 2
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
|
@ -773,6 +773,14 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
|
||||
select ? from t1;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? from t1' at line 1
|
||||
drop table t1;
|
||||
CREATE TABLE b12651_T1(a int) ENGINE=MYISAM;
|
||||
CREATE TABLE b12651_T2(b int) ENGINE=MYISAM;
|
||||
CREATE VIEW b12651_V1 as SELECT b FROM b12651_T2;
|
||||
PREPARE b12651 FROM 'SELECT 1 FROM b12651_T1 WHERE a IN (SELECT b FROM b12651_V1)';
|
||||
EXECUTE b12651;
|
||||
1
|
||||
DROP VIEW b12651_V1;
|
||||
DROP TABLE b12651_T1, b12651_T2;
|
||||
prepare stmt from "select @@time_zone";
|
||||
execute stmt;
|
||||
@@time_zone
|
||||
|
@ -156,3 +156,60 @@ slave: 6
|
||||
drop procedure p1;
|
||||
drop function f1;
|
||||
drop table t1,t2;
|
||||
create table t1 (a int);
|
||||
create procedure p1()
|
||||
begin
|
||||
insert into t1 values(@x);
|
||||
set @x=@x+1;
|
||||
insert into t1 values(@x);
|
||||
if (f2()) then
|
||||
insert into t1 values(1243);
|
||||
end if;
|
||||
end//
|
||||
create function f2() returns int
|
||||
begin
|
||||
insert into t1 values(@z);
|
||||
set @z=@z+1;
|
||||
insert into t1 values(@z);
|
||||
return 0;
|
||||
end//
|
||||
create function f1() returns int
|
||||
begin
|
||||
insert into t1 values(@y);
|
||||
call p1();
|
||||
return 0;
|
||||
end//
|
||||
set @x=10;
|
||||
set @y=20;
|
||||
set @z=100;
|
||||
select f1();
|
||||
f1()
|
||||
0
|
||||
set @x=30;
|
||||
call p1();
|
||||
select 'master', a from t1;
|
||||
master a
|
||||
master 20
|
||||
master 10
|
||||
master 11
|
||||
master 100
|
||||
master 101
|
||||
master 30
|
||||
master 31
|
||||
master 101
|
||||
master 102
|
||||
select 'slave', a from t1;
|
||||
slave a
|
||||
slave 20
|
||||
slave 10
|
||||
slave 11
|
||||
slave 100
|
||||
slave 101
|
||||
slave 30
|
||||
slave 31
|
||||
slave 101
|
||||
slave 102
|
||||
drop table t1;
|
||||
drop function f1;
|
||||
drop function f2;
|
||||
drop procedure p1;
|
||||
|
@ -3085,6 +3085,19 @@ column_name bug10055(t.column_name)
|
||||
id id
|
||||
data data
|
||||
drop function bug10055|
|
||||
drop procedure if exists bug12297|
|
||||
create procedure bug12297(lim int)
|
||||
begin
|
||||
set @x = 0;
|
||||
repeat
|
||||
insert into t1(id,data)
|
||||
values('aa', @x);
|
||||
set @x = @x + 1;
|
||||
until @x >= lim
|
||||
end repeat;
|
||||
end|
|
||||
call bug12297(10)|
|
||||
drop procedure bug12297|
|
||||
drop function if exists f_bug11247|
|
||||
drop procedure if exists p_bug11247|
|
||||
create function f_bug11247(param int)
|
||||
|
@ -6,6 +6,10 @@
|
||||
# This test makes no sense with the embedded server
|
||||
--source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
|
||||
#connect (con1,localhost,root,,"");
|
||||
#show tables;
|
||||
connect (con1,localhost,root,,mysql);
|
||||
@ -77,4 +81,18 @@ show tables;
|
||||
delete from mysql.user where user=_binary"test";
|
||||
flush privileges;
|
||||
|
||||
#
|
||||
# Bug#12517: Clear user variables and replication events before
|
||||
# closing temp tables in thread cleanup.
|
||||
connect (con2,localhost,root,,test);
|
||||
connection con2;
|
||||
create table t1 (id integer not null auto_increment primary key);
|
||||
create temporary table t2(id integer not null auto_increment primary key);
|
||||
set @id := 1;
|
||||
delete from t1 where id like @id;
|
||||
disconnect con2;
|
||||
--sleep 5
|
||||
connection default;
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
@ -580,7 +580,6 @@ SELECT COUNT(DISTINCT(t1.id)), LEFT(err_comment, 256) AS comment
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
|
||||
#
|
||||
# Bug #12266 GROUP BY expression on DATE column produces result with
|
||||
# reduced length
|
||||
@ -602,6 +601,16 @@ SELECT n+1 AS n FROM t1 GROUP BY n;
|
||||
--enable_ps_protocol
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# BUG#12695: Item_func_isnull::update_used_tables
|
||||
# did not update const_item_cache
|
||||
#
|
||||
create table t1(f1 varchar(5) key);
|
||||
insert into t1 values (1),(2);
|
||||
select sql_buffer_result max(f1) is null from t1;
|
||||
select sql_buffer_result max(f1)+1 from t1;
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
|
@ -250,6 +250,32 @@ SELECT IFNULL(a, 'TEST'), COALESCE(b, 'TEST') FROM t2
|
||||
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
#
|
||||
# Test for bug #11543: ROLLUP query with a repeated column in GROUP BY
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a INT(10) NOT NULL, b INT(10) NOT NULL);
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
INSERT INTO t1 VALUES (1, 2);
|
||||
|
||||
SELECT a, b, a AS c, COUNT(*) AS count FROM t1 GROUP BY a, b, c WITH ROLLUP;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
# Bug #12885(1): derived table specified by a subquery with
|
||||
# ROLLUP over expressions on not nullable group by attributes
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a int(11) NOT NULL);
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
|
||||
SELECT * FROM (SELECT a, a + 1, COUNT(*) FROM t1 GROUP BY a WITH ROLLUP) t;
|
||||
SELECT * FROM (SELECT a, LENGTH(a), COUNT(*) FROM t1 GROUP BY a WITH ROLLUP) t;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Tests for bug #11639: ROLLUP over view executed through filesort
|
||||
#
|
||||
@ -266,15 +292,20 @@ EXPLAIN SELECT type FROM v1 GROUP BY type WITH ROLLUP;
|
||||
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
# Test for bug #11543: ROLLUP query with a repeated column in GROUP BY
|
||||
|
||||
#
|
||||
# Bug #12885(2): view specified by a subquery with
|
||||
# ROLLUP over expressions on not nullable group by attributes
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a INT(10) NOT NULL, b INT(10) NOT NULL);
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
INSERT INTO t1 VALUES (1, 2);
|
||||
CREATE TABLE t1 (a int(11) NOT NULL);
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
|
||||
SELECT a, b, a AS c, COUNT(*) AS count FROM t1 GROUP BY a, b, c WITH ROLLUP;
|
||||
CREATE VIEW v1 AS
|
||||
SELECT a, LENGTH(a), COUNT(*) FROM t1 GROUP BY a WITH ROLLUP;
|
||||
|
||||
DESC v1;
|
||||
SELECT * FROM v1;
|
||||
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
@ -809,6 +809,21 @@ select ??;
|
||||
select ? from t1;
|
||||
--enable_ps_protocol
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#12651
|
||||
# (Crash on a PS including a subquery which is a select from a simple view)
|
||||
#
|
||||
CREATE TABLE b12651_T1(a int) ENGINE=MYISAM;
|
||||
CREATE TABLE b12651_T2(b int) ENGINE=MYISAM;
|
||||
CREATE VIEW b12651_V1 as SELECT b FROM b12651_T2;
|
||||
|
||||
PREPARE b12651 FROM 'SELECT 1 FROM b12651_T1 WHERE a IN (SELECT b FROM b12651_V1)';
|
||||
EXECUTE b12651;
|
||||
|
||||
DROP VIEW b12651_V1;
|
||||
DROP TABLE b12651_T1, b12651_T2;
|
||||
|
||||
#
|
||||
# Bug#9359 "Prepared statements take snapshot of system vars at PREPARE
|
||||
# time"
|
||||
|
@ -152,4 +152,52 @@ drop procedure p1;
|
||||
drop function f1;
|
||||
drop table t1,t2;
|
||||
|
||||
# BUG#12637: User variables + SPs replication
|
||||
create table t1 (a int);
|
||||
delimiter //;
|
||||
create procedure p1()
|
||||
begin
|
||||
insert into t1 values(@x);
|
||||
set @x=@x+1;
|
||||
insert into t1 values(@x);
|
||||
if (f2()) then
|
||||
insert into t1 values(1243);
|
||||
end if;
|
||||
end//
|
||||
|
||||
create function f2() returns int
|
||||
begin
|
||||
insert into t1 values(@z);
|
||||
set @z=@z+1;
|
||||
insert into t1 values(@z);
|
||||
return 0;
|
||||
end//
|
||||
|
||||
create function f1() returns int
|
||||
begin
|
||||
insert into t1 values(@y);
|
||||
call p1();
|
||||
return 0;
|
||||
end//
|
||||
|
||||
delimiter ;//
|
||||
|
||||
set @x=10;
|
||||
set @y=20;
|
||||
set @z=100;
|
||||
select f1();
|
||||
|
||||
set @x=30;
|
||||
call p1();
|
||||
|
||||
select 'master', a from t1;
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
select 'slave', a from t1;
|
||||
|
||||
connection master;
|
||||
drop table t1;
|
||||
drop function f1;
|
||||
drop function f2;
|
||||
drop procedure p1;
|
||||
sync_slave_with_master;
|
||||
|
@ -3877,29 +3877,23 @@ drop function bug10055|
|
||||
# consumption by passing large input parameter.
|
||||
#
|
||||
|
||||
#
|
||||
# Note: the test is currenly disabled because of the
|
||||
# Bug #12637: SP crashes the server if it has update query with user var
|
||||
# & binlog is enabled.
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
#drop procedure if exists bug12297|
|
||||
drop procedure if exists bug12297|
|
||||
--enable_warnings
|
||||
|
||||
#create procedure bug12297(lim int)
|
||||
#begin
|
||||
# set @x = 0;
|
||||
# repeat
|
||||
# insert into t1(id,data)
|
||||
# values('aa', @x);
|
||||
# set @x = @x + 1;
|
||||
# until @x >= lim
|
||||
# end repeat;
|
||||
#end|
|
||||
create procedure bug12297(lim int)
|
||||
begin
|
||||
set @x = 0;
|
||||
repeat
|
||||
insert into t1(id,data)
|
||||
values('aa', @x);
|
||||
set @x = @x + 1;
|
||||
until @x >= lim
|
||||
end repeat;
|
||||
end|
|
||||
|
||||
#call bug12297(10)|
|
||||
#drop procedure bug12297|
|
||||
call bug12297(10)|
|
||||
drop procedure bug12297|
|
||||
|
||||
#
|
||||
# Bug #11247 "Stored procedures: Function calls in long loops leak memory"
|
||||
|
Reference in New Issue
Block a user