Commit ac1852b4 authored by unknown's avatar unknown

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

into mysql.com:/home/my/mysql-5.0

parents 32895fe3 80ddfccf
...@@ -102,3 +102,10 @@ select * from t1 procedure analyse(); ...@@ -102,3 +102,10 @@ select * from t1 procedure analyse();
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
test.t1.v " \\ 1 19 0 0 3.7619 NULL ENUM('"','""','"c','\'\0\\"','\'','\'\'','\'b','a\0\0\0b','a\0','a""""b','a\'\'\'\'b','abc','abc\'def\\hij"klm\0opq','a\\\\\\\\b','b\'','c"','d\\','The\ZEnd','\\','\\d','\\\\') NOT NULL test.t1.v " \\ 1 19 0 0 3.7619 NULL ENUM('"','""','"c','\'\0\\"','\'','\'\'','\'b','a\0\0\0b','a\0','a""""b','a\'\'\'\'b','abc','abc\'def\\hij"klm\0opq','a\\\\\\\\b','b\'','c"','d\\','The\ZEnd','\\','\\d','\\\\') NOT NULL
drop table t1; drop table t1;
create table t1 (df decimal(5,1));
insert into t1 values(1.1);
insert into t1 values(2.2);
select * from t1 procedure analyse();
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
test.t1.df 1.1 2.2 8 8 0 0 1.650000000 0.302500000 ENUM('1.1','2.2') NOT NULL
drop table t1;
...@@ -187,3 +187,19 @@ timediff(cast('2004-12-30 12:00:00' as time), '12:00:00') ...@@ -187,3 +187,19 @@ timediff(cast('2004-12-30 12:00:00' as time), '12:00:00')
select timediff(cast('1 12:00:00' as time), '12:00:00'); select timediff(cast('1 12:00:00' as time), '12:00:00');
timediff(cast('1 12:00:00' as time), '12:00:00') timediff(cast('1 12:00:00' as time), '12:00:00')
24:00:00 24:00:00
select cast('1.2' as decimal(3,2));
cast('1.2' as decimal(3,2))
1.20
select 1e18 * cast('1.2' as decimal(3,2));
1e18 * cast('1.2' as decimal(3,2))
1.2e+18
select cast(cast('1.2' as decimal(3,2)) as signed);
cast(cast('1.2' as decimal(3,2)) as signed)
1
set @v1=1e18;
select cast(@v1 as decimal(22, 2));
cast(@v1 as decimal(22, 2))
1000000000000000000.00
select cast(-1e18 as decimal(22,2));
cast(-1e18 as decimal(22,2))
-1000000000000000000.00
...@@ -769,3 +769,38 @@ show columns from t2; ...@@ -769,3 +769,38 @@ show columns from t2;
Field Type Null Key Default Extra Field Type Null Key Default Extra
f2 datetime NO 0000-00-00 00:00:00 f2 datetime NO 0000-00-00 00:00:00
drop table t2, t1; drop table t2, t1;
create table t2 (ff double);
insert into t2 values (2.2);
select cast(sum(distinct ff) as decimal(5,2)) from t2;
cast(sum(distinct ff) as decimal(5,2))
2.20
select cast(sum(distinct ff) as signed) from t2;
cast(sum(distinct ff) as signed)
2
select cast(variance(ff) as decimal(10,3)) from t2;
cast(variance(ff) as decimal(10,3))
0.000
select cast(min(ff) as decimal(5,2)) from t2;
cast(min(ff) as decimal(5,2))
2.20
create table t1 (df decimal(5,1));
insert into t1 values(1.1);
insert into t1 values(2.2);
select cast(sum(distinct df) as signed) from t1;
cast(sum(distinct df) as signed)
3
select cast(min(df) as signed) from t1;
cast(min(df) as signed)
0
select 1e8 * sum(distinct df) from t1;
1e8 * sum(distinct df)
330000000
select 1e8 * min(df) from t1;
1e8 * min(df)
110000000
create table t3 (ifl int);
insert into t3 values(1), (2);
select cast(min(ifl) as decimal(5,2)) from t3;
cast(min(ifl) as decimal(5,2))
1.00
drop table t1, t2, t3;
...@@ -1798,3 +1798,5 @@ Variable_name Value ...@@ -1798,3 +1798,5 @@ Variable_name Value
innodb_thread_sleep_delay 10000 innodb_thread_sleep_delay 10000
create table t1 (v varchar(16384)) engine=innodb; create table t1 (v varchar(16384)) engine=innodb;
ERROR 42000: Column length too big for column 'v' (max = 255); use BLOB instead ERROR 42000: Column length too big for column 'v' (max = 255); use BLOB instead
create table t1 (a bit, key(a)) engine=innodb;
ERROR 42000: The storage engine for the table doesn't support BIT FIELD
...@@ -2276,3 +2276,39 @@ pass userid parentid parentgroup childid groupname grouptypeid crse categoryid c ...@@ -2276,3 +2276,39 @@ pass userid parentid parentgroup childid groupname grouptypeid crse categoryid c
1 5141 12 group2 12 group2 5 1 2 88 Oct04 1 5141 12 group2 12 group2 5 1 2 88 Oct04
1 5141 12 group2 12 group2 5 1 2 89 Oct04 1 5141 12 group2 12 group2 5 1 2 89 Oct04
drop table if exists t1, t2, t3, t4, t5; drop table if exists t1, t2, t3, t4, t5;
create table t1 (df decimal(5,1));
insert into t1 values(1.1);
insert into t1 values(2.2);
select * from t1 where df <= all (select avg(df) from t1 group by df);
df
1.1
select * from t1 where df >= all (select avg(df) from t1 group by df);
df
2.2
drop table t1;
create table t1 (df decimal(5,1));
insert into t1 values(1.1);
select 1.1 * exists(select * from t1);
1.1 * exists(select * from t1)
1.1
drop table t1;
CREATE TABLE t1 (
grp int(11) default NULL,
a decimal(10,2) default NULL);
insert into t1 values (1, 1), (2, 2), (2, 3), (3, 4), (3, 5), (3, 6), (NULL, NULL);
select * from t1;
grp a
1 1.00
2 2.00
2 3.00
3 4.00
3 5.00
3 6.00
NULL NULL
select min(a) from t1 group by grp;
min(a)
NULL
1.00
2.00
4.00
drop table t1;
...@@ -44,8 +44,6 @@ t1 CREATE TABLE `t1` ( ...@@ -44,8 +44,6 @@ t1 CREATE TABLE `t1` (
`a` bit(1) default NULL `a` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
create table t1 (a bit, key(a)) engine=innodb;
ERROR 42000: The storage engine for the table doesn't support BIT FIELD
create table t1 (a bit(64)); create table t1 (a bit(64));
insert into t1 values insert into t1 values
(b'1111111111111111111111111111111111111111111111111111111111111111'), (b'1111111111111111111111111111111111111111111111111111111111111111'),
......
...@@ -47,3 +47,11 @@ create table t1 (v varchar(128)); ...@@ -47,3 +47,11 @@ create table t1 (v varchar(128));
insert into t1 values ('abc'),('abc\'def\\hij\"klm\0opq'),('\''),('\"'),('\\'),('a\0'),('b\''),('c\"'),('d\\'),('\'b'),('\"c'),('\\d'),('a\0\0\0b'),('a\'\'\'\'b'),('a\"\"\"\"b'),('a\\\\\\\\b'),('\'\0\\\"'),('\'\''),('\"\"'),('\\\\'),('The\ZEnd'); insert into t1 values ('abc'),('abc\'def\\hij\"klm\0opq'),('\''),('\"'),('\\'),('a\0'),('b\''),('c\"'),('d\\'),('\'b'),('\"c'),('\\d'),('a\0\0\0b'),('a\'\'\'\'b'),('a\"\"\"\"b'),('a\\\\\\\\b'),('\'\0\\\"'),('\'\''),('\"\"'),('\\\\'),('The\ZEnd');
select * from t1 procedure analyse(); select * from t1 procedure analyse();
drop table t1; drop table t1;
#decimal-related test
create table t1 (df decimal(5,1));
insert into t1 values(1.1);
insert into t1 values(2.2);
select * from t1 procedure analyse();
drop table t1;
...@@ -118,3 +118,11 @@ select date_add(cast('2004-12-30 12:00:00' as date), interval 0 hour); ...@@ -118,3 +118,11 @@ select date_add(cast('2004-12-30 12:00:00' as date), interval 0 hour);
select timediff(cast('2004-12-30 12:00:00' as time), '12:00:00'); select timediff(cast('2004-12-30 12:00:00' as time), '12:00:00');
# Still we should not throw away "days" part of time value # Still we should not throw away "days" part of time value
select timediff(cast('1 12:00:00' as time), '12:00:00'); select timediff(cast('1 12:00:00' as time), '12:00:00');
#decimal-related additions
select cast('1.2' as decimal(3,2));
select 1e18 * cast('1.2' as decimal(3,2));
select cast(cast('1.2' as decimal(3,2)) as signed);
set @v1=1e18;
select cast(@v1 as decimal(22, 2));
select cast(-1e18 as decimal(22,2));
...@@ -492,3 +492,25 @@ drop table t2; ...@@ -492,3 +492,25 @@ drop table t2;
create table t2 select f2 from (select now() f2 from t1) a; create table t2 select f2 from (select now() f2 from t1) a;
show columns from t2; show columns from t2;
drop table t2, t1; drop table t2, t1;
# decimal-related tests
create table t2 (ff double);
insert into t2 values (2.2);
select cast(sum(distinct ff) as decimal(5,2)) from t2;
select cast(sum(distinct ff) as signed) from t2;
select cast(variance(ff) as decimal(10,3)) from t2;
select cast(min(ff) as decimal(5,2)) from t2;
create table t1 (df decimal(5,1));
insert into t1 values(1.1);
insert into t1 values(2.2);
select cast(sum(distinct df) as signed) from t1;
select cast(min(df) as signed) from t1;
select 1e8 * sum(distinct df) from t1;
select 1e8 * min(df) from t1;
create table t3 (ifl int);
insert into t3 values(1), (2);
select cast(min(ifl) as decimal(5,2)) from t3;
drop table t1, t2, t3;
...@@ -1278,3 +1278,7 @@ show variables like "innodb_thread_sleep_delay"; ...@@ -1278,3 +1278,7 @@ show variables like "innodb_thread_sleep_delay";
# InnoDB specific varchar tests # InnoDB specific varchar tests
--error 1074 --error 1074
create table t1 (v varchar(16384)) engine=innodb; create table t1 (v varchar(16384)) engine=innodb;
# The following should be moved to type_bit.test when innodb will support it
--error 1178
create table t1 (a bit, key(a)) engine=innodb;
...@@ -1543,3 +1543,26 @@ group by ...@@ -1543,3 +1543,26 @@ group by
drop table if exists t1, t2, t3, t4, t5; drop table if exists t1, t2, t3, t4, t5;
#decimal-related tests
create table t1 (df decimal(5,1));
insert into t1 values(1.1);
insert into t1 values(2.2);
select * from t1 where df <= all (select avg(df) from t1 group by df);
select * from t1 where df >= all (select avg(df) from t1 group by df);
drop table t1;
create table t1 (df decimal(5,1));
insert into t1 values(1.1);
select 1.1 * exists(select * from t1);
drop table t1;
CREATE TABLE t1 (
grp int(11) default NULL,
a decimal(10,2) default NULL);
insert into t1 values (1, 1), (2, 2), (2, 3), (3, 4), (3, 5), (3, 6), (NULL, NULL);
select * from t1;
select min(a) from t1 group by grp;
drop table t1;
...@@ -26,9 +26,6 @@ create table t1 (a bit(0)); ...@@ -26,9 +26,6 @@ create table t1 (a bit(0));
show create table t1; show create table t1;
drop table t1; drop table t1;
--error 1178
create table t1 (a bit, key(a)) engine=innodb;
create table t1 (a bit(64)); create table t1 (a bit(64));
insert into t1 values insert into t1 values
(b'1111111111111111111111111111111111111111111111111111111111111111'), (b'1111111111111111111111111111111111111111111111111111111111111111'),
......
...@@ -2245,9 +2245,9 @@ void Dbdict::checkSchemaStatus(Signal* signal) ...@@ -2245,9 +2245,9 @@ void Dbdict::checkSchemaStatus(Signal* signal)
restartCreateTab(signal, tableId, oldEntry, false); restartCreateTab(signal, tableId, oldEntry, false);
return; return;
}//if }//if
ndbrequire(ok);
break;
} }
ndbrequire(ok);
break;
} }
case SchemaFile::DROP_TABLE_STARTED: case SchemaFile::DROP_TABLE_STARTED:
jam(); jam();
......
...@@ -504,6 +504,7 @@ sp_head::execute(THD *thd) ...@@ -504,6 +504,7 @@ sp_head::execute(THD *thd)
break; break;
DBUG_PRINT("execute", ("Instruction %u", ip)); DBUG_PRINT("execute", ("Instruction %u", ip));
ret= i->execute(thd, &ip); ret= i->execute(thd, &ip);
thd->rollback_item_tree_changes();
if (i->free_list) if (i->free_list)
cleanup_items(i->free_list); cleanup_items(i->free_list);
// Check if an exception has occurred and a handler has been found // Check if an exception has occurred and a handler has been found
...@@ -1195,7 +1196,6 @@ sp_instr_stmt::exec_stmt(THD *thd, LEX *lex) ...@@ -1195,7 +1196,6 @@ sp_instr_stmt::exec_stmt(THD *thd, LEX *lex)
res= mysql_execute_command(thd); res= mysql_execute_command(thd);
lex->unit.cleanup(); lex->unit.cleanup();
thd->rollback_item_tree_changes();
if (thd->lock || thd->open_tables || thd->derived_tables) if (thd->lock || thd->open_tables || thd->derived_tables)
{ {
thd->proc_info="closing tables"; thd->proc_info="closing tables";
......
...@@ -83,14 +83,14 @@ class TC_LOG_DUMMY: public TC_LOG // use it to disable the logging ...@@ -83,14 +83,14 @@ class TC_LOG_DUMMY: public TC_LOG // use it to disable the logging
#ifdef HAVE_MMAP #ifdef HAVE_MMAP
class TC_LOG_MMAP: public TC_LOG class TC_LOG_MMAP: public TC_LOG
{ {
private: public: // only to keep Sun Forte on sol9x86 happy
typedef enum { typedef enum {
POOL, // page is in pool POOL, // page is in pool
ERROR, // last sync failed ERROR, // last sync failed
DIRTY // new xids added since last sync DIRTY // new xids added since last sync
} PAGE_STATE; } PAGE_STATE;
private:
typedef struct st_page { typedef struct st_page {
struct st_page *next; // page a linked in a fifo queue struct st_page *next; // page a linked in a fifo queue
my_xid *start, *end; // usable area of a page my_xid *start, *end; // usable area of a page
......
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