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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
5772a50b
Commit
5772a50b
authored
Dec 12, 2008
by
Gleb Shchepa
Browse files
Options
Browse Files
Download
Plain Diff
rollback of bug #40761 fix
parents
09219a03
03f9b2ce
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
29 additions
and
57 deletions
+29
-57
mysql-test/r/func_if.result
mysql-test/r/func_if.result
+0
-9
mysql-test/t/func_if.test
mysql-test/t/func_if.test
+0
-13
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+28
-22
sql/item_cmpfunc.h
sql/item_cmpfunc.h
+1
-1
sql/item_func.cc
sql/item_func.cc
+0
-10
sql/item_func.h
sql/item_func.h
+0
-2
No files found.
mysql-test/r/func_if.result
View file @
5772a50b
...
@@ -176,13 +176,4 @@ IF((ROUND(t1.a,2)=1), 2,
...
@@ -176,13 +176,4 @@ IF((ROUND(t1.a,2)=1), 2,
IF((ROUND(t1.a,2)=1), 2,
IF((ROUND(t1.a,2)=1), 2,
IF((R
IF((R
DROP TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (c LONGTEXT);
INSERT INTO t1 VALUES(1), (2), (3), (4), ('12345678901234567890');
SELECT * FROM (SELECT MAX(IF(1, CAST(c AS UNSIGNED), 0)) FROM t1) AS te;
MAX(IF(1, CAST(c AS UNSIGNED), 0))
12345678901234567890
SELECT * FROM (SELECT MAX(IFNULL(CAST(c AS UNSIGNED), 0)) FROM t1) AS te;
MAX(IFNULL(CAST(c AS UNSIGNED), 0))
12345678901234567890
DROP TABLE t1;
End of 5.0 tests
End of 5.0 tests
mysql-test/t/func_if.test
View file @
5772a50b
...
@@ -150,17 +150,4 @@ FROM t1;
...
@@ -150,17 +150,4 @@ FROM t1;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
# Bug #40761: Assert on sum func on IF(..., CAST(longtext AS UNSIGNED), signed)
# (was: LEFT JOIN on inline view crashes server)
#
CREATE
TABLE
t1
(
c
LONGTEXT
);
INSERT
INTO
t1
VALUES
(
1
),
(
2
),
(
3
),
(
4
),
(
'12345678901234567890'
);
SELECT
*
FROM
(
SELECT
MAX
(
IF
(
1
,
CAST
(
c
AS
UNSIGNED
),
0
))
FROM
t1
)
AS
te
;
SELECT
*
FROM
(
SELECT
MAX
(
IFNULL
(
CAST
(
c
AS
UNSIGNED
),
0
))
FROM
t1
)
AS
te
;
DROP
TABLE
t1
;
--
echo
End
of
5.0
tests
--
echo
End
of
5.0
tests
sql/item_cmpfunc.cc
View file @
5772a50b
...
@@ -2132,23 +2132,21 @@ Item_func_ifnull::fix_length_and_dec()
...
@@ -2132,23 +2132,21 @@ Item_func_ifnull::fix_length_and_dec()
{
{
agg_result_type
(
&
hybrid_type
,
args
,
2
);
agg_result_type
(
&
hybrid_type
,
args
,
2
);
maybe_null
=
args
[
1
]
->
maybe_null
;
maybe_null
=
args
[
1
]
->
maybe_null
;
decimals
=
max
(
args
[
0
]
->
decimals
,
args
[
1
]
->
decimals
);
unsigned_flag
=
args
[
0
]
->
unsigned_flag
&&
args
[
1
]
->
unsigned_flag
;
if
(
hybrid_type
==
DECIMAL_RESULT
||
hybrid_type
==
INT_RESULT
)
if
(
hybrid_type
==
DECIMAL_RESULT
||
hybrid_type
==
INT_RESULT
)
{
{
max_length
=
0
;
int
len0
=
args
[
0
]
->
max_length
-
args
[
0
]
->
decimals
decimals
=
0
;
-
(
args
[
0
]
->
unsigned_flag
?
0
:
1
)
;
unsigned_flag
=
TRUE
;
agg_num_lengths
(
args
[
0
]);
int
len1
=
args
[
1
]
->
max_length
-
args
[
1
]
->
decimals
agg_num_lengths
(
args
[
1
]
);
-
(
args
[
1
]
->
unsigned_flag
?
0
:
1
);
max_length
=
my_decimal_precision_to_length
(
max_length
+
decimals
,
decimals
,
unsigned_flag
);
max_length
=
max
(
len0
,
len1
)
+
decimals
+
(
unsigned_flag
?
0
:
1
);
}
}
else
else
{
max_length
=
max
(
args
[
0
]
->
max_length
,
args
[
1
]
->
max_length
);
max_length
=
max
(
args
[
0
]
->
max_length
,
args
[
1
]
->
max_length
);
decimals
=
max
(
args
[
0
]
->
decimals
,
args
[
1
]
->
decimals
);
unsigned_flag
=
args
[
0
]
->
unsigned_flag
&&
args
[
1
]
->
unsigned_flag
;
}
switch
(
hybrid_type
)
{
switch
(
hybrid_type
)
{
case
STRING_RESULT
:
case
STRING_RESULT
:
...
@@ -2302,6 +2300,8 @@ void
...
@@ -2302,6 +2300,8 @@ void
Item_func_if
::
fix_length_and_dec
()
Item_func_if
::
fix_length_and_dec
()
{
{
maybe_null
=
args
[
1
]
->
maybe_null
||
args
[
2
]
->
maybe_null
;
maybe_null
=
args
[
1
]
->
maybe_null
||
args
[
2
]
->
maybe_null
;
decimals
=
max
(
args
[
1
]
->
decimals
,
args
[
2
]
->
decimals
);
unsigned_flag
=
args
[
1
]
->
unsigned_flag
&&
args
[
2
]
->
unsigned_flag
;
enum
Item_result
arg1_type
=
args
[
1
]
->
result_type
();
enum
Item_result
arg1_type
=
args
[
1
]
->
result_type
();
enum
Item_result
arg2_type
=
args
[
2
]
->
result_type
();
enum
Item_result
arg2_type
=
args
[
2
]
->
result_type
();
...
@@ -2338,20 +2338,16 @@ Item_func_if::fix_length_and_dec()
...
@@ -2338,20 +2338,16 @@ Item_func_if::fix_length_and_dec()
if
((
cached_result_type
==
DECIMAL_RESULT
)
if
((
cached_result_type
==
DECIMAL_RESULT
)
||
(
cached_result_type
==
INT_RESULT
))
||
(
cached_result_type
==
INT_RESULT
))
{
{
max_length
=
0
;
int
len1
=
args
[
1
]
->
max_length
-
args
[
1
]
->
decimals
decimals
=
0
;
-
(
args
[
1
]
->
unsigned_flag
?
0
:
1
)
;
unsigned_flag
=
TRUE
;
agg_num_lengths
(
args
[
1
]);
int
len2
=
args
[
2
]
->
max_length
-
args
[
2
]
->
decimals
agg_num_lengths
(
args
[
2
]
);
-
(
args
[
2
]
->
unsigned_flag
?
0
:
1
);
max_length
=
my_decimal_precision_to_length
(
max_length
+
decimals
,
decimals
,
unsigned_flag
);
max_length
=
max
(
len1
,
len2
)
+
decimals
+
(
unsigned_flag
?
0
:
1
);
}
}
else
else
{
max_length
=
max
(
args
[
1
]
->
max_length
,
args
[
2
]
->
max_length
);
max_length
=
max
(
args
[
1
]
->
max_length
,
args
[
2
]
->
max_length
);
decimals
=
max
(
args
[
1
]
->
decimals
,
args
[
2
]
->
decimals
);
unsigned_flag
=
args
[
1
]
->
unsigned_flag
&&
args
[
2
]
->
unsigned_flag
;
}
}
}
...
@@ -2667,6 +2663,16 @@ void Item_func_case::agg_str_lengths(Item* arg)
...
@@ -2667,6 +2663,16 @@ void Item_func_case::agg_str_lengths(Item* arg)
}
}
void
Item_func_case
::
agg_num_lengths
(
Item
*
arg
)
{
uint
len
=
my_decimal_length_to_precision
(
arg
->
max_length
,
arg
->
decimals
,
arg
->
unsigned_flag
)
-
arg
->
decimals
;
set_if_bigger
(
max_length
,
len
);
set_if_bigger
(
decimals
,
arg
->
decimals
);
unsigned_flag
=
unsigned_flag
&&
arg
->
unsigned_flag
;
}
void
Item_func_case
::
fix_length_and_dec
()
void
Item_func_case
::
fix_length_and_dec
()
{
{
Item
**
agg
;
Item
**
agg
;
...
...
sql/item_cmpfunc.h
View file @
5772a50b
...
@@ -728,7 +728,6 @@ public:
...
@@ -728,7 +728,6 @@ public:
table_map
not_null_tables
()
const
{
return
0
;
}
table_map
not_null_tables
()
const
{
return
0
;
}
bool
is_null
();
bool
is_null
();
void
agg_str_lengths
(
Item
*
arg
);
};
};
...
@@ -1161,6 +1160,7 @@ public:
...
@@ -1161,6 +1160,7 @@ public:
CHARSET_INFO
*
compare_collation
()
{
return
cmp_collation
.
collation
;
}
CHARSET_INFO
*
compare_collation
()
{
return
cmp_collation
.
collation
;
}
void
cleanup
();
void
cleanup
();
void
agg_str_lengths
(
Item
*
arg
);
void
agg_str_lengths
(
Item
*
arg
);
void
agg_num_lengths
(
Item
*
arg
);
};
};
/*
/*
...
...
sql/item_func.cc
View file @
5772a50b
...
@@ -6086,13 +6086,3 @@ longlong Item_func_uuid_short::val_int()
...
@@ -6086,13 +6086,3 @@ longlong Item_func_uuid_short::val_int()
pthread_mutex_unlock
(
&
LOCK_uuid_generator
);
pthread_mutex_unlock
(
&
LOCK_uuid_generator
);
return
(
longlong
)
val
;
return
(
longlong
)
val
;
}
}
void
Item_func
::
agg_num_lengths
(
Item
*
arg
)
{
uint
len
=
my_decimal_length_to_precision
(
arg
->
max_length
,
arg
->
decimals
,
arg
->
unsigned_flag
)
-
arg
->
decimals
;
set_if_bigger
(
max_length
,
len
);
set_if_bigger
(
decimals
,
arg
->
decimals
);
unsigned_flag
=
unsigned_flag
&&
arg
->
unsigned_flag
;
}
sql/item_func.h
View file @
5772a50b
...
@@ -200,8 +200,6 @@ public:
...
@@ -200,8 +200,6 @@ public:
null_value
=
1
;
null_value
=
1
;
return
0.0
;
return
0.0
;
}
}
protected:
void
agg_num_lengths
(
Item
*
arg
);
};
};
...
...
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