Commit 9b74b046 authored by unknown's avatar unknown

Merge mysql.com:/usr/local/bk/mysql-5.0

into  mysql.com:/home/pem/work/mysql-5.0


mysql-test/r/sp.result:
  This will be regenerated...
mysql-test/t/sp.test:
  Manual merge.
parents 4c19f0e9 b262e643
......@@ -103,8 +103,8 @@ t1 CREATE TABLE `t1` (
`c2` varchar(1) character set latin1 collate latin1_danish_ci NOT NULL default '',
`c3` varbinary(1) NOT NULL default '',
`c4` varbinary(1) NOT NULL default '',
`c5` varbinary(4) NOT NULL default '',
`c6` varbinary(4) NOT NULL default '',
`c5` varbinary(3) NOT NULL default '',
`c6` varbinary(3) NOT NULL default '',
`c7` decimal(2,1) NOT NULL default '0.0',
`c8` decimal(2,1) NOT NULL default '0.0',
`c9` decimal(2,1) default NULL,
......@@ -152,11 +152,11 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`COALESCE(1)` int(1) NOT NULL default '0',
`COALESCE(1.0)` decimal(2,1) NOT NULL default '0.0',
`COALESCE(1.0)` decimal(2,1) unsigned NOT NULL default '0.0',
`COALESCE('a')` varchar(1) NOT NULL default '',
`COALESCE(1,1.0)` decimal(2,1) NOT NULL default '0.0',
`COALESCE(1,'1')` varbinary(1) NOT NULL default '',
`COALESCE(1.1,'1')` varbinary(4) NOT NULL default '',
`COALESCE(1.1,'1')` varbinary(3) NOT NULL default '',
`COALESCE('a' COLLATE latin1_bin,'b')` varchar(1) character set latin1 collate latin1_bin NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
......
......@@ -669,15 +669,15 @@ b varchar(10),
index (a,b)
) engine=myisam;
insert into t2 values ( null, '');
insert into t2 values ( 9999999999.9999, '');
insert into t2 values ( 9999999999.999, '');
insert into t3 select * from t2;
select min(a), max(a) from t1;
min(a) max(a)
9999999999.9999 9999999999.9999
9999999999.9990 9999999999.9990
flush tables;
select min(a), max(a) from t1;
min(a) max(a)
9999999999.9999 9999999999.9999
9999999999.9990 9999999999.9990
drop table t1, t2, t3;
create table t1 (a int,b int,c int, index (a,b,c));
create table t2 (a int,b int,c int, index (a,b,c));
......
......@@ -2,7 +2,7 @@ drop table if exists t1,t2;
select 1, 1.0, -1, "hello", NULL;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def 1 8 1 1 N 32897 0 63
def 1.0 246 4 3 N 129 1 63
def 1.0 246 3 3 N 161 1 63
def -1 8 2 2 N 32897 0 63
def hello 253 5 5 N 1 31 8
def NULL 6 0 0 Y 32896 0 63
......
......@@ -1775,7 +1775,7 @@ Table Create Table
t5 CREATE TABLE `t5` (
`const01` bigint(1) NOT NULL default '0',
`param01` bigint(20) default NULL,
`const02` decimal(2,1) NOT NULL default '0.0',
`const02` decimal(2,1) unsigned NOT NULL default '0.0',
`param02` decimal(65,30) default NULL,
`const03` double NOT NULL default '0',
`param03` double default NULL,
......@@ -1805,7 +1805,7 @@ select * from t5 ;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t5 t5 const01 const01 8 1 1 N 32769 0 63
def test t5 t5 param01 param01 8 20 1 Y 32768 0 63
def test t5 t5 const02 const02 246 4 3 N 1 1 63
def test t5 t5 const02 const02 246 3 3 N 33 1 63
def test t5 t5 param02 param02 246 67 32 Y 0 30 63
def test t5 t5 const03 const03 5 17 1 N 32769 31 63
def test t5 t5 param03 param03 5 23 1 Y 32768 31 63
......
......@@ -1758,7 +1758,7 @@ Table Create Table
t5 CREATE TABLE `t5` (
`const01` bigint(1) NOT NULL default '0',
`param01` bigint(20) default NULL,
`const02` decimal(2,1) NOT NULL default '0.0',
`const02` decimal(2,1) unsigned NOT NULL default '0.0',
`param02` decimal(65,30) default NULL,
`const03` double NOT NULL default '0',
`param03` double default NULL,
......@@ -1788,7 +1788,7 @@ select * from t5 ;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t5 t5 const01 const01 8 1 1 N 32769 0 63
def test t5 t5 param01 param01 8 20 1 Y 32768 0 63
def test t5 t5 const02 const02 246 4 3 N 1 1 63
def test t5 t5 const02 const02 246 3 3 N 33 1 63
def test t5 t5 param02 param02 246 67 32 Y 0 30 63
def test t5 t5 const03 const03 5 17 1 N 32769 31 63
def test t5 t5 param03 param03 5 23 1 Y 32768 31 63
......
......@@ -1759,7 +1759,7 @@ Table Create Table
t5 CREATE TABLE `t5` (
`const01` bigint(1) NOT NULL default '0',
`param01` bigint(20) default NULL,
`const02` decimal(2,1) NOT NULL default '0.0',
`const02` decimal(2,1) unsigned NOT NULL default '0.0',
`param02` decimal(65,30) default NULL,
`const03` double NOT NULL default '0',
`param03` double default NULL,
......@@ -1789,7 +1789,7 @@ select * from t5 ;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t5 t5 const01 const01 8 1 1 N 32769 0 63
def test t5 t5 param01 param01 8 20 1 Y 32768 0 63
def test t5 t5 const02 const02 246 4 3 N 1 1 63
def test t5 t5 const02 const02 246 3 3 N 33 1 63
def test t5 t5 param02 param02 246 67 32 Y 0 30 63
def test t5 t5 const03 const03 5 17 1 N 32769 31 63
def test t5 t5 param03 param03 5 23 1 Y 32768 31 63
......
......@@ -1695,7 +1695,7 @@ Table Create Table
t5 CREATE TABLE `t5` (
`const01` bigint(1) NOT NULL default '0',
`param01` bigint(20) default NULL,
`const02` decimal(2,1) NOT NULL default '0.0',
`const02` decimal(2,1) unsigned NOT NULL default '0.0',
`param02` decimal(65,30) default NULL,
`const03` double NOT NULL default '0',
`param03` double default NULL,
......@@ -1725,7 +1725,7 @@ select * from t5 ;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t5 t5 const01 const01 8 1 1 N 32769 0 63
def test t5 t5 param01 param01 8 20 1 Y 32768 0 63
def test t5 t5 const02 const02 246 4 3 N 1 1 63
def test t5 t5 const02 const02 246 3 3 N 33 1 63
def test t5 t5 param02 param02 246 67 32 Y 0 30 63
def test t5 t5 const03 const03 5 17 1 N 32769 31 63
def test t5 t5 param03 param03 5 23 1 Y 32768 31 63
......@@ -4707,7 +4707,7 @@ Table Create Table
t5 CREATE TABLE `t5` (
`const01` bigint(1) NOT NULL default '0',
`param01` bigint(20) default NULL,
`const02` decimal(2,1) NOT NULL default '0.0',
`const02` decimal(2,1) unsigned NOT NULL default '0.0',
`param02` decimal(65,30) default NULL,
`const03` double NOT NULL default '0',
`param03` double default NULL,
......@@ -4737,7 +4737,7 @@ select * from t5 ;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t5 t5 const01 const01 8 1 1 N 32769 0 63
def test t5 t5 param01 param01 8 20 1 Y 32768 0 63
def test t5 t5 const02 const02 246 4 3 N 1 1 63
def test t5 t5 const02 const02 246 3 3 N 33 1 63
def test t5 t5 param02 param02 246 67 32 Y 0 30 63
def test t5 t5 const03 const03 5 17 1 N 32769 31 63
def test t5 t5 param03 param03 5 23 1 Y 32768 31 63
......
......@@ -1758,7 +1758,7 @@ Table Create Table
t5 CREATE TABLE `t5` (
`const01` bigint(1) NOT NULL default '0',
`param01` bigint(20) default NULL,
`const02` decimal(2,1) NOT NULL default '0.0',
`const02` decimal(2,1) unsigned NOT NULL default '0.0',
`param02` decimal(65,30) default NULL,
`const03` double NOT NULL default '0',
`param03` double default NULL,
......@@ -1788,7 +1788,7 @@ select * from t5 ;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t5 t5 const01 const01 8 1 1 N 32769 0 63
def test t5 t5 param01 param01 8 20 1 Y 32768 0 63
def test t5 t5 const02 const02 246 4 3 N 1 1 63
def test t5 t5 const02 const02 246 3 3 N 33 1 63
def test t5 t5 param02 param02 246 67 32 Y 0 30 63
def test t5 t5 const03 const03 5 17 1 N 32769 31 63
def test t5 t5 param03 param03 5 23 1 Y 32768 31 63
......
......@@ -1758,7 +1758,7 @@ Table Create Table
t5 CREATE TABLE `t5` (
`const01` bigint(1) NOT NULL default '0',
`param01` bigint(20) default NULL,
`const02` decimal(2,1) NOT NULL default '0.0',
`const02` decimal(2,1) unsigned NOT NULL default '0.0',
`param02` decimal(65,30) default NULL,
`const03` double NOT NULL default '0',
`param03` double default NULL,
......@@ -1788,7 +1788,7 @@ select * from t5 ;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t5 t5 const01 const01 8 1 1 N 32769 0 63
def test t5 t5 param01 param01 8 20 1 Y 32768 0 63
def test t5 t5 const02 const02 246 4 3 N 1 1 63
def test t5 t5 const02 const02 246 3 3 N 33 1 63
def test t5 t5 param02 param02 246 67 32 Y 0 30 63
def test t5 t5 const03 const03 5 17 1 N 32769 31 63
def test t5 t5 param03 param03 5 23 1 Y 32768 31 63
......
......@@ -68,10 +68,10 @@ NULL 1.1 NULL NULL NULL 1
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`nullif(1.1, 1.1)` decimal(2,1) default NULL,
`nullif(1.1, 1.2)` decimal(2,1) default NULL,
`nullif(1.1, 0.11e1)` decimal(2,1) default NULL,
`nullif(1.0, 1)` decimal(2,1) default NULL,
`nullif(1.1, 1.1)` decimal(2,1) unsigned default NULL,
`nullif(1.1, 1.2)` decimal(2,1) unsigned default NULL,
`nullif(1.1, 0.11e1)` decimal(2,1) unsigned default NULL,
`nullif(1.0, 1)` decimal(2,1) unsigned default NULL,
`nullif(1, 1.0)` int(1) default NULL,
`nullif(1, 1.1)` int(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
......@@ -174,9 +174,9 @@ create table t1 select round(15.4,-1), truncate(-5678.123451,-3), abs(-1.1), -(-
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`round(15.4,-1)` decimal(3,0) NOT NULL default '0',
`round(15.4,-1)` decimal(3,0) unsigned NOT NULL default '0',
`truncate(-5678.123451,-3)` decimal(4,0) NOT NULL default '0',
`abs(-1.1)` decimal(3,1) NOT NULL default '0.0',
`abs(-1.1)` decimal(2,1) NOT NULL default '0.0',
`-(-1.1)` decimal(2,1) NOT NULL default '0.0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
......@@ -781,7 +781,7 @@ create table t1 as select 0.5;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`0.5` decimal(2,1) NOT NULL default '0.0'
`0.5` decimal(2,1) unsigned NOT NULL default '0.0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select round(1.5),round(2.5);
......
......@@ -314,7 +314,7 @@ create table t3 (
) engine=myisam;
insert into t2 values ( null, '');
insert into t2 values ( 9999999999.9999, '');
insert into t2 values ( 9999999999.999, '');
insert into t3 select * from t2;
select min(a), max(a) from t1;
flush tables;
......
......@@ -4264,6 +4264,56 @@ drop table t3|
drop procedure bug6127|
#
# BUG#12589: Assert when creating temp. table from decimal stored procedure
# variable
#
--disable_warnings
drop procedure if exists bug12589_1|
drop procedure if exists bug12589_2|
drop procedure if exists bug12589_3|
--enable_warnings
create procedure bug12589_1()
begin
declare spv1 decimal(3,3);
set spv1= 123.456;
set spv1 = 'test';
create temporary table tm1 as select spv1;
show create table tm1;
drop temporary table tm1;
end|
create procedure bug12589_2()
begin
declare spv1 decimal(6,3);
set spv1= 123.456;
create temporary table tm1 as select spv1;
show create table tm1;
drop temporary table tm1;
end|
create procedure bug12589_3()
begin
declare spv1 decimal(6,3);
set spv1= -123.456;
create temporary table tm1 as select spv1;
show create table tm1;
drop temporary table tm1;
end|
# Note: The type of the field will match the value, not the declared
# type of the variable. (This is a type checking issue which
# might be changed later.)
# Warning expected from "set spv1 = 'test'", the value is set to decimal "0".
call bug12589_1()|
# No warnings here
call bug12589_2()|
call bug12589_3()|
#
# BUG#7049: Stored procedure CALL errors are ignored
#
......
......@@ -904,6 +904,7 @@ bool Item_splocal::fix_fields(THD *, Item **)
DBUG_ASSERT(it->fixed);
max_length= it->max_length;
decimals= it->decimals;
unsigned_flag= it->unsigned_flag;
fixed= 1;
return FALSE;
}
......@@ -1804,6 +1805,7 @@ Item_decimal::Item_decimal(const char *str_arg, uint length,
name= (char*) str_arg;
decimals= (uint8) decimal_value.frac;
fixed= 1;
unsigned_flag= !decimal_value.sign();
max_length= my_decimal_precision_to_length(decimal_value.intg + decimals,
decimals, unsigned_flag);
}
......@@ -1813,6 +1815,7 @@ Item_decimal::Item_decimal(longlong val, bool unsig)
int2my_decimal(E_DEC_FATAL_ERROR, val, unsig, &decimal_value);
decimals= (uint8) decimal_value.frac;
fixed= 1;
unsigned_flag= !decimal_value.sign();
max_length= my_decimal_precision_to_length(decimal_value.intg + decimals,
decimals, unsigned_flag);
}
......@@ -1823,6 +1826,7 @@ Item_decimal::Item_decimal(double val, int precision, int scale)
double2my_decimal(E_DEC_FATAL_ERROR, val, &decimal_value);
decimals= (uint8) decimal_value.frac;
fixed= 1;
unsigned_flag= !decimal_value.sign();
max_length= my_decimal_precision_to_length(decimal_value.intg + decimals,
decimals, unsigned_flag);
}
......@@ -1835,6 +1839,7 @@ Item_decimal::Item_decimal(const char *str, const my_decimal *val_arg,
name= (char*) str;
decimals= (uint8) decimal_par;
max_length= length;
unsigned_flag= !decimal_value.sign();
fixed= 1;
}
......@@ -1844,8 +1849,9 @@ Item_decimal::Item_decimal(my_decimal *value_par)
my_decimal2decimal(value_par, &decimal_value);
decimals= (uint8) decimal_value.frac;
fixed= 1;
unsigned_flag= !decimal_value.sign();
max_length= my_decimal_precision_to_length(decimal_value.intg + decimals,
decimals, !decimal_value.sign());
decimals, unsigned_flag);
}
......@@ -1855,8 +1861,9 @@ Item_decimal::Item_decimal(const char *bin, int precision, int scale)
&decimal_value, precision, scale);
decimals= (uint8) decimal_value.frac;
fixed= 1;
unsigned_flag= !decimal_value.sign();
max_length= my_decimal_precision_to_length(precision, decimals,
!decimal_value.sign());
unsigned_flag);
}
......
......@@ -1394,12 +1394,13 @@ int view_checksum(THD *thd, TABLE_LIST *view)
*/
bool
mysql_rename_view(THD *thd,
const char *new_name,
TABLE_LIST *view)
const char *new_name,
TABLE_LIST *view)
{
LEX_STRING pathstr, file;
File_parser *parser;
char view_path[FN_REFLEN];
bool error= TRUE;
DBUG_ENTER("mysql_rename_view");
......@@ -1411,19 +1412,20 @@ mysql_rename_view(THD *thd,
pathstr.length= strlen(view_path);
if ((parser= sql_parse_prepare(&pathstr, thd->mem_root, 1)) &&
is_equal(&view_type, parser->type())) {
is_equal(&view_type, parser->type()))
{
char dir_buff[FN_REFLEN], file_buff[FN_REFLEN];
/* get view definition and source */
if (mysql_make_view(parser, view) ||
parser->parse((gptr)view, thd->mem_root,
view_parameters + source_number_position, 1))
DBUG_RETURN(1);
goto err;
/* rename view and it's backups */
if (rename_in_schema_file(view->db, view->table_name, new_name,
view->revision - 1, num_view_backups))
DBUG_RETURN(1);
goto err;
strxnmov(dir_buff, FN_REFLEN, mysql_data_home, "/", view->db, "/", NullS);
(void) unpack_filename(dir_buff, dir_buff);
......@@ -1436,11 +1438,13 @@ mysql_rename_view(THD *thd,
- file_buff);
if (sql_create_definition_file(&pathstr, &file, view_file_type,
(gptr)view, view_parameters, num_view_backups)) {
(gptr)view, view_parameters,
num_view_backups))
{
/* restore renamed view in case of error */
rename_in_schema_file(view->db, new_name, view->table_name,
view->revision - 1, num_view_backups);
DBUG_RETURN(1);
goto err;
}
} else
DBUG_RETURN(1);
......@@ -1448,5 +1452,13 @@ mysql_rename_view(THD *thd,
/* remove cache entries */
query_cache_invalidate3(thd, view, 0);
sp_cache_invalidate();
DBUG_RETURN(0);
error= FALSE;
err:
/*
We have to explicitly call destructor for view's LEX since it won't
be called otherwise.
*/
delete view->view;
DBUG_RETURN(error);
}
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