1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

Merge tulin@bk-internal.mysql.com:/home/bk/mysql-5.0

into poseidon.ndb.mysql.com:/home/tomas/mysql-5.1


sql/item.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
sql/table.cc:
  Auto merged
This commit is contained in:
unknown
2005-05-31 21:30:26 +02:00
19 changed files with 320 additions and 27 deletions

View File

@ -253,7 +253,7 @@ concat(':',product,':') sum(profit) avg(profit)
:Computer: 6900 1380.00000
:Phone: 10 10.00000
:TV: 600 120.00000
:TV: 7785 519.00000
NULL 7785 519.00000
select product, country_id , year, sum(profit) from t1 group by product, country_id, year with cube;
ERROR 42000: This version of MySQL doesn't yet support 'CUBE'
explain select product, country_id , year, sum(profit) from t1 group by product, country_id, year with cube;
@ -489,3 +489,69 @@ a SUM(a) SUM(a)+1 CONCAT(SUM(a),'x') SUM(a)+SUM(a) SUM(a)
5 5 6 5x 10 5
NULL 8 9 8x 16 8
DROP TABLE t1;
CREATE TABLE t1 (a int(11));
INSERT INTO t1 VALUES (1),(2);
SELECT a, a+1, SUM(a) FROM t1 GROUP BY a WITH ROLLUP;
a a+1 SUM(a)
1 2 1
2 3 2
NULL NULL 3
SELECT a+1 FROM t1 GROUP BY a WITH ROLLUP;
a+1
2
3
NULL
SELECT a+SUM(a) FROM t1 GROUP BY a WITH ROLLUP;
a+SUM(a)
2
4
NULL
SELECT a, a+1 as b FROM t1 GROUP BY a WITH ROLLUP HAVING b > 2;
a b
2 3
SELECT a, a+1 as b FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NULL;
a b
NULL NULL
SELECT a, a+1 as b FROM t1 GROUP BY a WITH ROLLUP HAVING b IS NULL;
a b
NULL NULL
SELECT IFNULL(a, 'TEST') FROM t1 GROUP BY a WITH ROLLUP;
IFNULL(a, 'TEST')
1
2
TEST
CREATE TABLE t2 (a int, b int);
INSERT INTO t2 VALUES
(1,4),
(2,2), (2,2),
(4,1), (4,1), (4,1), (4,1),
(2,1), (2,1);
SELECT a,b,SUM(b) FROM t2 GROUP BY a,b WITH ROLLUP;
a b SUM(b)
1 4 4
1 NULL 4
2 1 2
2 2 4
2 NULL 6
4 1 4
4 NULL 4
NULL NULL 14
SELECT a,b,SUM(b), a+b as c FROM t2
GROUP BY a,b WITH ROLLUP HAVING c IS NULL;
a b SUM(b) c
1 NULL 4 NULL
2 NULL 6 NULL
4 NULL 4 NULL
NULL NULL 14 NULL
SELECT IFNULL(a, 'TEST'), COALESCE(b, 'TEST') FROM t2
GROUP BY a, b WITH ROLLUP;
IFNULL(a, 'TEST') COALESCE(b, 'TEST')
1 4
1 TEST
2 1
2 2
2 TEST
4 1
4 TEST
TEST TEST
DROP TABLE t1,t2;

View File

@ -646,4 +646,16 @@ drop procedure if exists bug10537|
create procedure bug10537()
load data local infile '/tmp/somefile' into table t1|
ERROR 0A000: LOAD DATA is not allowed in stored procedures
drop function if exists bug8409|
create function bug8409()
returns int
begin
flush tables;
return 5;
end|
ERROR 0A000: FLUSH is not allowed in stored procedures
create procedure bug9529_90123456789012345678901234567890123456789012345678901234567890()
begin
end|
ERROR 42000: Identifier name 'bug9529_90123456789012345678901234567890123456789012345678901234567890' is too long
drop table t1|

View File

@ -3098,4 +3098,15 @@ call bug5963_2(1)|
call bug5963_2(1)|
drop procedure bug5963_2|
drop table t3|
drop function if exists bug9559|
create function bug9559()
returns int
begin
set @y = -6/2;
return @y;
end|
select bug9559()|
bug9559()
-3
drop function bug9559|
drop table t1,t2;

View File

@ -220,3 +220,33 @@ SELECT a, SUM(a), SUM(a)+1, CONCAT(SUM(a),'x'), SUM(a)+SUM(a), SUM(a)
DROP TABLE t1;
#
# Tests for bug #7894: ROLLUP over expressions on group by attributes
#
CREATE TABLE t1 (a int(11));
INSERT INTO t1 VALUES (1),(2);
SELECT a, a+1, SUM(a) FROM t1 GROUP BY a WITH ROLLUP;
SELECT a+1 FROM t1 GROUP BY a WITH ROLLUP;
SELECT a+SUM(a) FROM t1 GROUP BY a WITH ROLLUP;
SELECT a, a+1 as b FROM t1 GROUP BY a WITH ROLLUP HAVING b > 2;
SELECT a, a+1 as b FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NULL;
SELECT a, a+1 as b FROM t1 GROUP BY a WITH ROLLUP HAVING b IS NULL;
SELECT IFNULL(a, 'TEST') FROM t1 GROUP BY a WITH ROLLUP;
CREATE TABLE t2 (a int, b int);
INSERT INTO t2 VALUES
(1,4),
(2,2), (2,2),
(4,1), (4,1), (4,1), (4,1),
(2,1), (2,1);
SELECT a,b,SUM(b) FROM t2 GROUP BY a,b WITH ROLLUP;
SELECT a,b,SUM(b), a+b as c FROM t2
GROUP BY a,b WITH ROLLUP HAVING c IS NULL;
SELECT IFNULL(a, 'TEST'), COALESCE(b, 'TEST') FROM t2
GROUP BY a, b WITH ROLLUP;
DROP TABLE t1,t2;

View File

@ -905,6 +905,31 @@ create procedure bug10537()
load data local infile '/tmp/somefile' into table t1|
#
# BUG#8409: Stored procedure crash if function contains FLUSH
#
--disable_warnings
drop function if exists bug8409|
--enable_warnings
--error ER_SP_BADSTATEMENT
create function bug8409()
returns int
begin
flush tables;
return 5;
end|
#
# BUG#9529: Stored Procedures: No Warning on truncation of procedure name
# during creation.
#
--error ER_TOO_LONG_IDENT
create procedure bug9529_90123456789012345678901234567890123456789012345678901234567890()
begin
end|
#
# BUG#NNNN: New bug synopsis
#

View File

@ -3801,6 +3801,25 @@ call bug5963_2(1)|
drop procedure bug5963_2|
drop table t3|
#
# BUG#9559: Functions: Numeric Operations using -ve value gives incorrect
# results.
#
--disable_warnings
drop function if exists bug9559|
--enable_warnings
create function bug9559()
returns int
begin
set @y = -6/2;
return @y;
end|
select bug9559()|
drop function bug9559|
#
# BUG#NNNN: New bug synopsis
#