Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
83c103ed
Commit
83c103ed
authored
Oct 10, 2005
by
hf@deer.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk@192.168.21.1:/usr/home/bk/mysql-4.1
into deer.(none):/home/hf/work/mysql-4.1.13372
parents
99838052
f0dfa195
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
80 additions
and
5 deletions
+80
-5
mysql-test/r/type_decimal.result
mysql-test/r/type_decimal.result
+16
-1
mysql-test/r/type_float.result
mysql-test/r/type_float.result
+15
-0
mysql-test/r/union.result
mysql-test/r/union.result
+1
-1
mysql-test/t/type_decimal.test
mysql-test/t/type_decimal.test
+13
-1
mysql-test/t/type_float.test
mysql-test/t/type_float.test
+13
-0
sql/item.cc
sql/item.cc
+22
-2
No files found.
mysql-test/r/type_decimal.result
View file @
83c103ed
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t1
, t2, t3
;
SET SQL_WARNINGS=1;
CREATE TABLE t1 (
id int(11) NOT NULL auto_increment,
...
...
@@ -655,3 +655,18 @@ select * from t1;
a b
123.12345 123.1
drop table t1;
create table t1 (d decimal(10,1));
create table t2 (d decimal(10,9));
insert into t1 values ("100000000.0");
insert into t2 values ("1.23456780");
create table t3 select * from t2 union select * from t1;
select * from t3;
d
1.234567800
100000000.000000000
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`d` decimal(18,9) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2, t3;
mysql-test/r/type_float.result
View file @
83c103ed
...
...
@@ -235,3 +235,18 @@ select * from t1 where reckey=1.09E2;
reckey recdesc
109 Has 109 as key
drop table t1;
create table t1 (d double(10,1));
create table t2 (d double(10,9));
insert into t1 values ("100000000.0");
insert into t2 values ("1.23456780");
create table t3 select * from t2 union select * from t1;
select * from t3;
d
1.234567800
100000000.000000000
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`d` double(22,9) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2, t3;
mysql-test/r/union.result
View file @
83c103ed
...
...
@@ -565,7 +565,7 @@ a
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` double(
53
,1) NOT NULL default '0.0'
`a` double(
21
,1) NOT NULL default '0.0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t2 (it1 tinyint, it2 tinyint not null, i int not null, ib bigint, f float, d double, y year, da date, dt datetime, sc char(10), sv varchar(10), b blob, tx text);
...
...
mysql-test/t/type_decimal.test
View file @
83c103ed
# bug in decimal() with negative numbers by kaido@tradenet.ee
--
disable_warnings
DROP
TABLE
IF
EXISTS
t1
;
DROP
TABLE
IF
EXISTS
t1
,
t2
,
t3
;
--
enable_warnings
SET
SQL_WARNINGS
=
1
;
...
...
@@ -276,4 +276,16 @@ update t1 set b=a;
select
*
from
t1
;
drop
table
t1
;
#
# Bug #13372 (decimal union)
#
create
table
t1
(
d
decimal
(
10
,
1
));
create
table
t2
(
d
decimal
(
10
,
9
));
insert
into
t1
values
(
"100000000.0"
);
insert
into
t2
values
(
"1.23456780"
);
create
table
t3
select
*
from
t2
union
select
*
from
t1
;
select
*
from
t3
;
show
create
table
t3
;
drop
table
t1
,
t2
,
t3
;
# End of 4.1 tests
mysql-test/t/type_float.test
View file @
83c103ed
...
...
@@ -149,4 +149,17 @@ select * from t1 where reckey=109;
select
*
from
t1
where
reckey
=
1.09E2
;
drop
table
t1
;
#
# Bug #13372 (decimal union)
#
create
table
t1
(
d
double
(
10
,
1
));
create
table
t2
(
d
double
(
10
,
9
));
insert
into
t1
values
(
"100000000.0"
);
insert
into
t2
values
(
"1.23456780"
);
create
table
t3
select
*
from
t2
union
select
*
from
t1
;
select
*
from
t3
;
show
create
table
t3
;
drop
table
t1
,
t2
,
t3
;
# End of 4.1 tests
sql/item.cc
View file @
83c103ed
...
...
@@ -3223,9 +3223,14 @@ enum_field_types Item_type_holder::get_real_type(Item *item)
bool
Item_type_holder
::
join_types
(
THD
*
thd
,
Item
*
item
)
{
uint
max_length_orig
=
max_length
;
uint
decimals_orig
=
decimals
;
max_length
=
max
(
max_length
,
display_length
(
item
));
decimals
=
max
(
decimals
,
item
->
decimals
);
fld_type
=
Field
::
field_type_merge
(
fld_type
,
get_real_type
(
item
));
if
(
Field
::
result_merge_type
(
fld_type
)
==
STRING_RESULT
)
switch
(
Field
::
result_merge_type
(
fld_type
))
{
case
STRING_RESULT
:
{
const
char
*
old_cs
,
*
old_derivation
;
old_cs
=
collation
.
collation
->
name
;
...
...
@@ -3239,8 +3244,23 @@ bool Item_type_holder::join_types(THD *thd, Item *item)
"UNION"
);
return
TRUE
;
}
break
;
}
decimals
=
max
(
decimals
,
item
->
decimals
);
case
REAL_RESULT
:
{
if
(
decimals
!=
NOT_FIXED_DEC
)
{
int
delta1
=
max_length_orig
-
decimals_orig
;
int
delta2
=
item
->
max_length
-
item
->
decimals
;
max_length
=
min
(
max
(
delta1
,
delta2
)
+
decimals
,
(
fld_type
==
MYSQL_TYPE_FLOAT
)
?
FLT_DIG
+
6
:
DBL_DIG
+
7
);
}
else
max_length
=
(
fld_type
==
MYSQL_TYPE_FLOAT
)
?
FLT_DIG
+
6
:
DBL_DIG
+
7
;
break
;
}
default:
;
};
maybe_null
|=
item
->
maybe_null
;
get_full_info
(
item
);
return
FALSE
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment