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
86c920ba
Commit
86c920ba
authored
Feb 14, 2006
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/usr_rh9/home/elkin.rh9/MySQL/BARE/mysql-5.0
into mysql.com:/usr_rh9/home/elkin.rh9/MySQL/Merge/5.0
parents
4e3f2e9d
b79df79b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
4 deletions
+21
-4
mysql-test/r/func_if.result
mysql-test/r/func_if.result
+7
-0
mysql-test/t/func_if.test
mysql-test/t/func_if.test
+8
-0
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+2
-1
sql/sql_select.cc
sql/sql_select.cc
+4
-3
No files found.
mysql-test/r/func_if.result
View file @
86c920ba
...
...
@@ -121,3 +121,10 @@ a NULLIF(a,'')
NULL NULL
NULL
DROP TABLE t1;
create table t1 (f1 int, f2 int);
insert into t1 values(1,1),(0,0);
select f1, f2, if(f1, 40.0, 5.00) from t1 group by f1 order by f2;
f1 f2 if(f1, 40.0, 5.00)
0 0 5.00
1 1 40.00
drop table t1;
mysql-test/t/func_if.test
View file @
86c920ba
...
...
@@ -89,3 +89,11 @@ SELECT a, NULLIF(a,'') FROM t1 WHERE NULLIF(a,'') IS NULL;
DROP
TABLE
t1
;
# End of 4.1 tests
#
# Bug #16272 IF function with decimal args can produce wrong result
#
create
table
t1
(
f1
int
,
f2
int
);
insert
into
t1
values
(
1
,
1
),(
0
,
0
);
select
f1
,
f2
,
if
(
f1
,
40.0
,
5.00
)
from
t1
group
by
f1
order
by
f2
;
drop
table
t1
;
sql/item_cmpfunc.cc
View file @
86c920ba
...
...
@@ -1383,7 +1383,8 @@ Item_func_if::fix_length_and_dec()
max_length
=
(
cached_result_type
==
DECIMAL_RESULT
||
cached_result_type
==
INT_RESULT
)
?
(
max
(
args
[
1
]
->
max_length
-
args
[
1
]
->
decimals
,
args
[
2
]
->
max_length
-
args
[
2
]
->
decimals
)
+
decimals
)
:
args
[
2
]
->
max_length
-
args
[
2
]
->
decimals
)
+
decimals
+
(
unsigned_flag
?
0
:
1
)
)
:
max
(
args
[
1
]
->
max_length
,
args
[
2
]
->
max_length
);
}
...
...
sql/sql_select.cc
View file @
86c920ba
...
...
@@ -12746,11 +12746,12 @@ calc_group_buffer(JOIN *join,ORDER *group)
Field
*
field
=
group_item
->
get_tmp_table_field
();
if
(
field
)
{
if
(
field
->
type
()
==
FIELD_TYPE_BLOB
)
enum_field_types
type
;
if
((
type
=
field
->
type
())
==
FIELD_TYPE_BLOB
)
key_length
+=
MAX_BLOB_WIDTH
;
// Can't be used as a key
else
if
(
field
->
type
()
==
MYSQL_TYPE_VARCHAR
)
else
if
(
type
==
MYSQL_TYPE_VARCHAR
||
type
==
MYSQL_TYPE_VAR_STRING
)
key_length
+=
field
->
field_length
+
HA_KEY_BLOB_LENGTH
;
else
if
(
field
->
type
()
==
FIELD_TYPE_BIT
)
else
if
(
type
==
FIELD_TYPE_BIT
)
{
/* Bit is usually stored as a longlong key for group fields */
key_length
+=
8
;
// Big enough
...
...
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