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
cdf80a26
Commit
cdf80a26
authored
Mar 22, 2007
by
mhansson/martin@linux-st28.site
Browse files
Options
Browse Files
Download
Plain Diff
Merge mhansson@bk-internal:/home/bk/mysql-5.0-opt
into linux-st28.site:/home/martin/mysql/src/5.0o-bug24791
parents
a016f71c
749976ee
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
58 additions
and
17 deletions
+58
-17
mysql-test/r/create.result
mysql-test/r/create.result
+2
-2
mysql-test/r/temp_table.result
mysql-test/r/temp_table.result
+21
-0
mysql-test/r/type_float.result
mysql-test/r/type_float.result
+4
-4
mysql-test/t/temp_table.test
mysql-test/t/temp_table.test
+16
-0
sql/field.h
sql/field.h
+1
-3
sql/item.cc
sql/item.cc
+11
-7
sql/item_sum.cc
sql/item_sum.cc
+3
-1
No files found.
mysql-test/r/create.result
View file @
cdf80a26
...
@@ -447,8 +447,8 @@ t2 CREATE TABLE `t2` (
...
@@ -447,8 +447,8 @@ t2 CREATE TABLE `t2` (
`ifnull(c,c)` mediumint(8) default NULL,
`ifnull(c,c)` mediumint(8) default NULL,
`ifnull(d,d)` int(11) default NULL,
`ifnull(d,d)` int(11) default NULL,
`ifnull(e,e)` bigint(20) default NULL,
`ifnull(e,e)` bigint(20) default NULL,
`ifnull(f,f)` float(
24
,2) default NULL,
`ifnull(f,f)` float(
3
,2) default NULL,
`ifnull(g,g)` double(
53
,3) default NULL,
`ifnull(g,g)` double(
4
,3) default NULL,
`ifnull(h,h)` decimal(5,4) default NULL,
`ifnull(h,h)` decimal(5,4) default NULL,
`ifnull(i,i)` year(4) default NULL,
`ifnull(i,i)` year(4) default NULL,
`ifnull(j,j)` date default NULL,
`ifnull(j,j)` date default NULL,
...
...
mysql-test/r/temp_table.result
View file @
cdf80a26
...
@@ -152,3 +152,24 @@ SELECT * FROM t1;
...
@@ -152,3 +152,24 @@ SELECT * FROM t1;
i
i
DROP TABLE t1;
DROP TABLE t1;
End of 4.1 tests.
End of 4.1 tests.
CREATE TABLE t1 ( c FLOAT( 20, 14 ) );
INSERT INTO t1 VALUES( 12139 );
CREATE TABLE t2 ( c FLOAT(30,18) );
INSERT INTO t2 VALUES( 123456 );
SELECT AVG( c ) FROM t1 UNION SELECT 1;
AVG( c )
12139
1
SELECT 1 UNION SELECT AVG( c ) FROM t1;
1
1
12139
SELECT 1 UNION SELECT * FROM t2 UNION SELECT 1;
1
1
123456
SELECT c/1 FROM t1 UNION SELECT 1;
c/1
12139
1
DROP TABLE t1, t2;
mysql-test/r/type_float.result
View file @
cdf80a26
...
@@ -92,7 +92,7 @@ show create table t2;
...
@@ -92,7 +92,7 @@ show create table t2;
Table Create Table
Table Create Table
t2 CREATE TABLE `t2` (
t2 CREATE TABLE `t2` (
`col1` double default NULL,
`col1` double default NULL,
`col2` double(
53
,5) default NULL,
`col2` double(
22
,5) default NULL,
`col3` double default NULL,
`col3` double default NULL,
`col4` double default NULL
`col4` double default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
) ENGINE=MyISAM DEFAULT CHARSET=latin1
...
@@ -232,12 +232,12 @@ insert into t2 values ("1.23456780");
...
@@ -232,12 +232,12 @@ insert into t2 values ("1.23456780");
create table t3 select * from t2 union select * from t1;
create table t3 select * from t2 union select * from t1;
select * from t3;
select * from t3;
d
d
1.2345678
00
1.2345678
100000000
.000000000
100000000
show create table t3;
show create table t3;
Table Create Table
Table Create Table
t3 CREATE TABLE `t3` (
t3 CREATE TABLE `t3` (
`d` double
(22,9)
default NULL
`d` double default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2, t3;
drop table t1, t2, t3;
create table t1 select 105213674794682365.00 + 0.0 x;
create table t1 select 105213674794682365.00 + 0.0 x;
...
...
mysql-test/t/temp_table.test
View file @
cdf80a26
...
@@ -163,3 +163,19 @@ DROP TABLE t1;
...
@@ -163,3 +163,19 @@ DROP TABLE t1;
--
echo
End
of
4.1
tests
.
--
echo
End
of
4.1
tests
.
#
# Bug #24791: Union with AVG-groups generates wrong results
#
CREATE
TABLE
t1
(
c
FLOAT
(
20
,
14
)
);
INSERT
INTO
t1
VALUES
(
12139
);
CREATE
TABLE
t2
(
c
FLOAT
(
30
,
18
)
);
INSERT
INTO
t2
VALUES
(
123456
);
SELECT
AVG
(
c
)
FROM
t1
UNION
SELECT
1
;
SELECT
1
UNION
SELECT
AVG
(
c
)
FROM
t1
;
SELECT
1
UNION
SELECT
*
FROM
t2
UNION
SELECT
1
;
SELECT
c
/
1
FROM
t1
UNION
SELECT
1
;
DROP
TABLE
t1
,
t2
;
sql/field.h
View file @
cdf80a26
...
@@ -432,6 +432,7 @@ class Field_real :public Field_num {
...
@@ -432,6 +432,7 @@ class Field_real :public Field_num {
int
store_decimal
(
const
my_decimal
*
);
int
store_decimal
(
const
my_decimal
*
);
my_decimal
*
val_decimal
(
my_decimal
*
);
my_decimal
*
val_decimal
(
my_decimal
*
);
uint32
max_display_length
()
{
return
field_length
;
}
};
};
...
@@ -461,7 +462,6 @@ class Field_decimal :public Field_real {
...
@@ -461,7 +462,6 @@ class Field_decimal :public Field_real {
void
overflow
(
bool
negative
);
void
overflow
(
bool
negative
);
bool
zero_pack
()
const
{
return
0
;
}
bool
zero_pack
()
const
{
return
0
;
}
void
sql_type
(
String
&
str
)
const
;
void
sql_type
(
String
&
str
)
const
;
uint32
max_display_length
()
{
return
field_length
;
}
};
};
...
@@ -719,7 +719,6 @@ class Field_float :public Field_real {
...
@@ -719,7 +719,6 @@ class Field_float :public Field_real {
void
sort_string
(
char
*
buff
,
uint
length
);
void
sort_string
(
char
*
buff
,
uint
length
);
uint32
pack_length
()
const
{
return
sizeof
(
float
);
}
uint32
pack_length
()
const
{
return
sizeof
(
float
);
}
void
sql_type
(
String
&
str
)
const
;
void
sql_type
(
String
&
str
)
const
;
uint32
max_display_length
()
{
return
24
;
}
};
};
...
@@ -762,7 +761,6 @@ class Field_double :public Field_real {
...
@@ -762,7 +761,6 @@ class Field_double :public Field_real {
void
sort_string
(
char
*
buff
,
uint
length
);
void
sort_string
(
char
*
buff
,
uint
length
);
uint32
pack_length
()
const
{
return
sizeof
(
double
);
}
uint32
pack_length
()
const
{
return
sizeof
(
double
);
}
void
sql_type
(
String
&
str
)
const
;
void
sql_type
(
String
&
str
)
const
;
uint32
max_display_length
()
{
return
53
;
}
uint
size_of
()
const
{
return
sizeof
(
*
this
);
}
uint
size_of
()
const
{
return
sizeof
(
*
this
);
}
};
};
...
...
sql/item.cc
View file @
cdf80a26
...
@@ -6348,8 +6348,6 @@ Item_type_holder::Item_type_holder(THD *thd, Item *item)
...
@@ -6348,8 +6348,6 @@ Item_type_holder::Item_type_holder(THD *thd, Item *item)
:
Item
(
thd
,
item
),
enum_set_typelib
(
0
),
fld_type
(
get_real_type
(
item
))
:
Item
(
thd
,
item
),
enum_set_typelib
(
0
),
fld_type
(
get_real_type
(
item
))
{
{
DBUG_ASSERT
(
item
->
fixed
);
DBUG_ASSERT
(
item
->
fixed
);
max_length
=
display_length
(
item
);
maybe_null
=
item
->
maybe_null
;
maybe_null
=
item
->
maybe_null
;
collation
.
set
(
item
->
collation
);
collation
.
set
(
item
->
collation
);
get_full_info
(
item
);
get_full_info
(
item
);
...
@@ -6521,11 +6519,17 @@ bool Item_type_holder::join_types(THD *thd, Item *item)
...
@@ -6521,11 +6519,17 @@ bool Item_type_holder::join_types(THD *thd, Item *item)
{
{
int
delta1
=
max_length_orig
-
decimals_orig
;
int
delta1
=
max_length_orig
-
decimals_orig
;
int
delta2
=
item
->
max_length
-
item
->
decimals
;
int
delta2
=
item
->
max_length
-
item
->
decimals
;
if
(
fld_type
==
MYSQL_TYPE_DECIMAL
)
max_length
=
max
(
delta1
,
delta2
)
+
decimals
;
max_length
=
max
(
delta1
,
delta2
)
+
decimals
;
if
(
fld_type
==
MYSQL_TYPE_FLOAT
&&
max_length
>
FLT_DIG
+
2
)
else
{
max_length
=
min
(
max
(
delta1
,
delta2
)
+
decimals
,
max_length
=
FLT_DIG
+
6
;
(
fld_type
==
MYSQL_TYPE_FLOAT
)
?
FLT_DIG
+
6
:
DBL_DIG
+
7
);
decimals
=
NOT_FIXED_DEC
;
}
if
(
fld_type
==
MYSQL_TYPE_DOUBLE
&&
max_length
>
DBL_DIG
+
2
)
{
max_length
=
DBL_DIG
+
7
;
decimals
=
NOT_FIXED_DEC
;
}
}
}
else
else
max_length
=
(
fld_type
==
MYSQL_TYPE_FLOAT
)
?
FLT_DIG
+
6
:
DBL_DIG
+
7
;
max_length
=
(
fld_type
==
MYSQL_TYPE_FLOAT
)
?
FLT_DIG
+
6
:
DBL_DIG
+
7
;
...
...
sql/item_sum.cc
View file @
cdf80a26
...
@@ -1121,8 +1121,10 @@ void Item_sum_avg::fix_length_and_dec()
...
@@ -1121,8 +1121,10 @@ void Item_sum_avg::fix_length_and_dec()
f_scale
=
args
[
0
]
->
decimals
;
f_scale
=
args
[
0
]
->
decimals
;
dec_bin_size
=
my_decimal_get_binary_size
(
f_precision
,
f_scale
);
dec_bin_size
=
my_decimal_get_binary_size
(
f_precision
,
f_scale
);
}
}
else
else
{
decimals
=
min
(
args
[
0
]
->
decimals
+
prec_increment
,
NOT_FIXED_DEC
);
decimals
=
min
(
args
[
0
]
->
decimals
+
prec_increment
,
NOT_FIXED_DEC
);
max_length
=
args
[
0
]
->
max_length
+
prec_increment
;
}
}
}
...
...
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