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
27fae2cb
Commit
27fae2cb
authored
Sep 13, 2006
by
kaa@polly.local
Browse files
Options
Browse Files
Download
Plain Diff
Merge polly.local:/tmp/20924/bug20294/my41-bug20294
into polly.local:/home/kaa/src/maint/m41-maint--07OGk
parents
f37d63ee
397f0df9
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
28 additions
and
126 deletions
+28
-126
mysql-test/r/case.result
mysql-test/r/case.result
+0
-7
mysql-test/r/func_if.result
mysql-test/r/func_if.result
+0
-7
mysql-test/r/func_test.result
mysql-test/r/func_test.result
+0
-7
mysql-test/r/user_var.result
mysql-test/r/user_var.result
+0
-5
mysql-test/t/case.test
mysql-test/t/case.test
+1
-9
mysql-test/t/func_if.test
mysql-test/t/func_if.test
+1
-15
mysql-test/t/func_test.test
mysql-test/t/func_test.test
+1
-9
mysql-test/t/user_var.test
mysql-test/t/user_var.test
+1
-9
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+12
-9
sql/item_cmpfunc.h
sql/item_cmpfunc.h
+0
-14
sql/item_func.cc
sql/item_func.cc
+10
-32
sql/item_func.h
sql/item_func.h
+1
-1
sql/log_event.cc
sql/log_event.cc
+1
-1
sql/sql_class.h
sql/sql_class.h
+0
-1
No files found.
mysql-test/r/case.result
View file @
27fae2cb
...
@@ -177,10 +177,3 @@ from t1 where b=3 group by b;
...
@@ -177,10 +177,3 @@ from t1 where b=3 group by b;
min(a) min(case when 1=1 then a else NULL end) min(case when 1!=1 then NULL else a end)
min(a) min(case when 1=1 then a else NULL end) min(case when 1!=1 then NULL else a end)
2 2 2
2 2 2
drop table t1;
drop table t1;
SELECT CASE 1 WHEN 1 THEN 18446744073709551615 ELSE 1 END;
CASE 1 WHEN 1 THEN 18446744073709551615 ELSE 1 END
18446744073709551615
SELECT COALESCE(18446744073709551615);
COALESCE(18446744073709551615)
18446744073709551615
End of 4.1 tests
mysql-test/r/func_if.result
View file @
27fae2cb
...
@@ -99,10 +99,3 @@ a NULLIF(a,'')
...
@@ -99,10 +99,3 @@ a NULLIF(a,'')
NULL NULL
NULL NULL
NULL
NULL
DROP TABLE t1;
DROP TABLE t1;
SELECT IF(1 != 0, 18446744073709551615, 1);
IF(1 != 0, 18446744073709551615, 1)
18446744073709551615
SELECT IFNULL(NULL, 18446744073709551615);
IFNULL(NULL, 18446744073709551615)
18446744073709551615
End of 4.1 tests
mysql-test/r/func_test.result
View file @
27fae2cb
...
@@ -183,10 +183,3 @@ select 5.1 mod 3, 5.1 mod -3, -5.1 mod 3, -5.1 mod -3;
...
@@ -183,10 +183,3 @@ select 5.1 mod 3, 5.1 mod -3, -5.1 mod 3, -5.1 mod -3;
select 5 mod 3, 5 mod -3, -5 mod 3, -5 mod -3;
select 5 mod 3, 5 mod -3, -5 mod 3, -5 mod -3;
5 mod 3 5 mod -3 -5 mod 3 -5 mod -3
5 mod 3 5 mod -3 -5 mod 3 -5 mod -3
2 2 -2 -2
2 2 -2 -2
SELECT GREATEST(1, 18446744073709551615);
GREATEST(1, 18446744073709551615)
18446744073709551615
SELECT LEAST(1, 18446744073709551615);
LEAST(1, 18446744073709551615)
1
End of 4.1 tests
mysql-test/r/user_var.result
View file @
27fae2cb
...
@@ -203,8 +203,3 @@ select @@global.version;
...
@@ -203,8 +203,3 @@ select @@global.version;
select @@session.VERSION;
select @@session.VERSION;
@@session.VERSION
@@session.VERSION
#
#
set @a=18446744073709551615;
select @a;
@a
18446744073709551615
End of 4.1 tests
mysql-test/t/case.test
View file @
27fae2cb
...
@@ -130,12 +130,4 @@ select min(a), min(case when 1=1 then a else NULL end),
...
@@ -130,12 +130,4 @@ select min(a), min(case when 1=1 then a else NULL end),
from
t1
where
b
=
3
group
by
b
;
from
t1
where
b
=
3
group
by
b
;
drop
table
t1
;
drop
table
t1
;
#
# End of 4.1 tests
# Bug #20924: CAST(expr as UNSIGNED) returns SIGNED value when used in various
# functions
# - UNSIGNED values in CASE and COALESCE are treated as SIGNED
#
SELECT
CASE
1
WHEN
1
THEN
18446744073709551615
ELSE
1
END
;
SELECT
COALESCE
(
18446744073709551615
);
--
echo
End
of
4.1
tests
mysql-test/t/func_if.test
View file @
27fae2cb
...
@@ -73,18 +73,4 @@ SELECT a, NULLIF(a,'') FROM t1 WHERE NULLIF(a,'') IS NULL;
...
@@ -73,18 +73,4 @@ SELECT a, NULLIF(a,'') FROM t1 WHERE NULLIF(a,'') IS NULL;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
# End of 4.1 tests
# Bug #20924: CAST(expr as UNSIGNED) returns SIGNED value when used in various
# functions
# - UNSIGNED values in IF() are treated as SIGNED
#
SELECT
IF
(
1
!=
0
,
18446744073709551615
,
1
);
#
# Bug #20924: CAST(expr as UNSIGNED) returns SIGNED value when used in various
# functions
# - UNSIGNED values in IFNULL() are treated as SIGNED
#
SELECT
IFNULL
(
NULL
,
18446744073709551615
);
--
echo
End
of
4.1
tests
mysql-test/t/func_test.test
View file @
27fae2cb
...
@@ -108,12 +108,4 @@ select 5.1 mod 3, 5.1 mod -3, -5.1 mod 3, -5.1 mod -3;
...
@@ -108,12 +108,4 @@ select 5.1 mod 3, 5.1 mod -3, -5.1 mod 3, -5.1 mod -3;
select
5
mod
3
,
5
mod
-
3
,
-
5
mod
3
,
-
5
mod
-
3
;
select
5
mod
3
,
5
mod
-
3
,
-
5
mod
3
,
-
5
mod
-
3
;
#
# End of 4.1 tests
# Bug #20924: CAST(expr as UNSIGNED) returns SIGNED value when used in various
# functions
# - UNSIGNED values in GREATEST() and LEAST() are treated as SIGNED
#
SELECT
GREATEST
(
1
,
18446744073709551615
);
SELECT
LEAST
(
1
,
18446744073709551615
);
--
echo
End
of
4.1
tests
mysql-test/t/user_var.test
View file @
27fae2cb
...
@@ -141,12 +141,4 @@ select @@global.version;
...
@@ -141,12 +141,4 @@ select @@global.version;
--
replace_column
1
#
--
replace_column
1
#
select
@@
session
.
VERSION
;
select
@@
session
.
VERSION
;
#
# End of 4.1 tests
# Bug #20924: CAST(expr as UNSIGNED) returns SIGNED value when used in various
# functions
# - SET on a user variable saves UNSIGNED as SIGNED
#
set
@
a
=
18446744073709551615
;
select
@
a
;
--
echo
End
of
4.1
tests
sql/item_cmpfunc.cc
View file @
27fae2cb
...
@@ -619,7 +619,11 @@ int Arg_comparator::compare_int_signed_unsigned()
...
@@ -619,7 +619,11 @@ int Arg_comparator::compare_int_signed_unsigned()
if
(
!
(
*
b
)
->
null_value
)
if
(
!
(
*
b
)
->
null_value
)
{
{
owner
->
null_value
=
0
;
owner
->
null_value
=
0
;
return
::
compare_int_signed_unsigned
(
sval1
,
uval2
);
if
(
sval1
<
0
||
(
ulonglong
)
sval1
<
uval2
)
return
-
1
;
if
((
ulonglong
)
sval1
==
uval2
)
return
0
;
return
1
;
}
}
}
}
owner
->
null_value
=
1
;
owner
->
null_value
=
1
;
...
@@ -640,7 +644,13 @@ int Arg_comparator::compare_int_unsigned_signed()
...
@@ -640,7 +644,13 @@ int Arg_comparator::compare_int_unsigned_signed()
if
(
!
(
*
b
)
->
null_value
)
if
(
!
(
*
b
)
->
null_value
)
{
{
owner
->
null_value
=
0
;
owner
->
null_value
=
0
;
return
::
compare_int_unsigned_signed
(
uval1
,
sval2
);
if
(
sval2
<
0
)
return
1
;
if
(
uval1
<
(
ulonglong
)
sval2
)
return
-
1
;
if
(
uval1
==
(
ulonglong
)
sval2
)
return
0
;
return
1
;
}
}
}
}
owner
->
null_value
=
1
;
owner
->
null_value
=
1
;
...
@@ -1152,13 +1162,11 @@ Item_func_ifnull::val_int()
...
@@ -1152,13 +1162,11 @@ Item_func_ifnull::val_int()
if
(
!
args
[
0
]
->
null_value
)
if
(
!
args
[
0
]
->
null_value
)
{
{
null_value
=
0
;
null_value
=
0
;
unsigned_flag
=
args
[
0
]
->
unsigned_flag
;
return
value
;
return
value
;
}
}
value
=
args
[
1
]
->
val_int
();
value
=
args
[
1
]
->
val_int
();
if
((
null_value
=
args
[
1
]
->
null_value
))
if
((
null_value
=
args
[
1
]
->
null_value
))
return
0
;
return
0
;
unsigned_flag
=
args
[
1
]
->
unsigned_flag
;
return
value
;
return
value
;
}
}
...
@@ -1278,7 +1286,6 @@ Item_func_if::val_int()
...
@@ -1278,7 +1286,6 @@ Item_func_if::val_int()
Item
*
arg
=
args
[
0
]
->
val_int
()
?
args
[
1
]
:
args
[
2
];
Item
*
arg
=
args
[
0
]
->
val_int
()
?
args
[
1
]
:
args
[
2
];
longlong
value
=
arg
->
val_int
();
longlong
value
=
arg
->
val_int
();
null_value
=
arg
->
null_value
;
null_value
=
arg
->
null_value
;
unsigned_flag
=
arg
->
unsigned_flag
;
return
value
;
return
value
;
}
}
...
@@ -1485,7 +1492,6 @@ longlong Item_func_case::val_int()
...
@@ -1485,7 +1492,6 @@ longlong Item_func_case::val_int()
}
}
res
=
item
->
val_int
();
res
=
item
->
val_int
();
null_value
=
item
->
null_value
;
null_value
=
item
->
null_value
;
unsigned_flag
=
item
->
unsigned_flag
;
return
res
;
return
res
;
}
}
...
@@ -1617,10 +1623,7 @@ longlong Item_func_coalesce::val_int()
...
@@ -1617,10 +1623,7 @@ longlong Item_func_coalesce::val_int()
{
{
longlong
res
=
args
[
i
]
->
val_int
();
longlong
res
=
args
[
i
]
->
val_int
();
if
(
!
args
[
i
]
->
null_value
)
if
(
!
args
[
i
]
->
null_value
)
{
unsigned_flag
=
args
[
i
]
->
unsigned_flag
;
return
res
;
return
res
;
}
}
}
null_value
=
1
;
null_value
=
1
;
return
0
;
return
0
;
...
...
sql/item_cmpfunc.h
View file @
27fae2cb
...
@@ -1079,17 +1079,3 @@ inline Item *and_conds(Item *a, Item *b)
...
@@ -1079,17 +1079,3 @@ inline Item *and_conds(Item *a, Item *b)
}
}
Item
*
and_expressions
(
Item
*
a
,
Item
*
b
,
Item
**
org_item
);
Item
*
and_expressions
(
Item
*
a
,
Item
*
b
,
Item
**
org_item
);
inline
int
compare_int_signed_unsigned
(
longlong
sval
,
ulonglong
uval
)
{
if
(
sval
<
0
||
(
ulonglong
)
sval
<
uval
)
return
-
1
;
if
((
ulonglong
)
sval
==
uval
)
return
0
;
return
1
;
}
inline
int
compare_int_unsigned_signed
(
ulonglong
uval
,
longlong
sval
)
{
return
-
compare_int_signed_unsigned
(
sval
,
uval
);
}
sql/item_func.cc
View file @
27fae2cb
...
@@ -1235,34 +1235,19 @@ longlong Item_func_min_max::val_int()
...
@@ -1235,34 +1235,19 @@ longlong Item_func_min_max::val_int()
{
{
DBUG_ASSERT
(
fixed
==
1
);
DBUG_ASSERT
(
fixed
==
1
);
longlong
value
=
0
;
longlong
value
=
0
;
my_bool
arg_unsigned_flag
;
my_bool
cmp
;
null_value
=
1
;
null_value
=
1
;
for
(
uint
i
=
0
;
i
<
arg_count
;
i
++
)
for
(
uint
i
=
0
;
i
<
arg_count
;
i
++
)
{
{
longlong
tmp
=
args
[
i
]
->
val_int
();
arg_unsigned_flag
=
args
[
i
]
->
unsigned_flag
;
if
(
null_value
)
if
(
null_value
)
{
{
value
=
tmp
;
value
=
args
[
i
]
->
val_int
()
;
null_value
=
args
[
i
]
->
null_value
;
null_value
=
args
[
i
]
->
null_value
;
unsigned_flag
=
arg_unsigned_flag
;
}
}
else
else
{
{
if
(
args
[
i
]
->
null_value
)
longlong
tmp
=
args
[
i
]
->
val_int
();
continue
;
if
(
!
args
[
i
]
->
null_value
&&
(
tmp
<
value
?
cmp_sign
:
-
cmp_sign
)
>
0
)
if
(
unsigned_flag
==
arg_unsigned_flag
)
value
=
tmp
;
cmp
=
tmp
<
value
;
else
if
(
unsigned_flag
)
cmp
=
compare_int_signed_unsigned
(
tmp
,
value
)
<
0
;
else
cmp
=
compare_int_unsigned_signed
(
tmp
,
value
)
<
0
;
if
((
cmp
?
cmp_sign
:
-
cmp_sign
)
>
0
)
{
value
=
tmp
;
unsigned_flag
=
arg_unsigned_flag
;
}
}
}
}
}
return
value
;
return
value
;
...
@@ -2328,7 +2313,6 @@ static user_var_entry *get_variable(HASH *hash, LEX_STRING &name,
...
@@ -2328,7 +2313,6 @@ static user_var_entry *get_variable(HASH *hash, LEX_STRING &name,
entry
->
length
=
0
;
entry
->
length
=
0
;
entry
->
update_query_id
=
0
;
entry
->
update_query_id
=
0
;
entry
->
collation
.
set
(
NULL
,
DERIVATION_IMPLICIT
);
entry
->
collation
.
set
(
NULL
,
DERIVATION_IMPLICIT
);
entry
->
unsigned_flag
=
0
;
/*
/*
If we are here, we were called from a SET or a query which sets a
If we are here, we were called from a SET or a query which sets a
variable. Imagine it is this:
variable. Imagine it is this:
...
@@ -2406,7 +2390,7 @@ Item_func_set_user_var::fix_length_and_dec()
...
@@ -2406,7 +2390,7 @@ Item_func_set_user_var::fix_length_and_dec()
bool
Item_func_set_user_var
::
update_hash
(
void
*
ptr
,
uint
length
,
bool
Item_func_set_user_var
::
update_hash
(
void
*
ptr
,
uint
length
,
Item_result
type
,
Item_result
type
,
CHARSET_INFO
*
cs
,
CHARSET_INFO
*
cs
,
Derivation
dv
,
bool
unsigned_arg
)
Derivation
dv
)
{
{
if
((
null_value
=
args
[
0
]
->
null_value
))
if
((
null_value
=
args
[
0
]
->
null_value
))
{
{
...
@@ -2453,7 +2437,6 @@ bool Item_func_set_user_var::update_hash(void *ptr, uint length,
...
@@ -2453,7 +2437,6 @@ bool Item_func_set_user_var::update_hash(void *ptr, uint length,
entry
->
length
=
length
;
entry
->
length
=
length
;
entry
->
type
=
type
;
entry
->
type
=
type
;
entry
->
collation
.
set
(
cs
,
dv
);
entry
->
collation
.
set
(
cs
,
dv
);
entry
->
unsigned_flag
=
unsigned_arg
;
}
}
return
0
;
return
0
;
...
@@ -2524,10 +2507,7 @@ String *user_var_entry::val_str(my_bool *null_value, String *str,
...
@@ -2524,10 +2507,7 @@ String *user_var_entry::val_str(my_bool *null_value, String *str,
str
->
set
(
*
(
double
*
)
value
,
decimals
,
&
my_charset_bin
);
str
->
set
(
*
(
double
*
)
value
,
decimals
,
&
my_charset_bin
);
break
;
break
;
case
INT_RESULT
:
case
INT_RESULT
:
if
(
!
unsigned_flag
)
str
->
set
(
*
(
longlong
*
)
value
,
&
my_charset_bin
);
str
->
set
(
*
(
longlong
*
)
value
,
&
my_charset_bin
);
else
str
->
set
(
*
(
ulonglong
*
)
value
,
&
my_charset_bin
);
break
;
break
;
case
STRING_RESULT
:
case
STRING_RESULT
:
if
(
str
->
copy
(
value
,
length
,
collation
.
collation
))
if
(
str
->
copy
(
value
,
length
,
collation
.
collation
))
...
@@ -2568,7 +2548,6 @@ Item_func_set_user_var::check()
...
@@ -2568,7 +2548,6 @@ Item_func_set_user_var::check()
case
INT_RESULT
:
case
INT_RESULT
:
{
{
save_result
.
vint
=
args
[
0
]
->
val_int
();
save_result
.
vint
=
args
[
0
]
->
val_int
();
unsigned_flag
=
args
[
0
]
->
unsigned_flag
;
break
;
break
;
}
}
case
STRING_RESULT
:
case
STRING_RESULT
:
...
@@ -2613,26 +2592,25 @@ Item_func_set_user_var::update()
...
@@ -2613,26 +2592,25 @@ Item_func_set_user_var::update()
case
REAL_RESULT
:
case
REAL_RESULT
:
{
{
res
=
update_hash
((
void
*
)
&
save_result
.
vreal
,
sizeof
(
save_result
.
vreal
),
res
=
update_hash
((
void
*
)
&
save_result
.
vreal
,
sizeof
(
save_result
.
vreal
),
REAL_RESULT
,
&
my_charset_bin
,
DERIVATION_IMPLICIT
,
0
);
REAL_RESULT
,
&
my_charset_bin
,
DERIVATION_IMPLICIT
);
break
;
break
;
}
}
case
INT_RESULT
:
case
INT_RESULT
:
{
{
res
=
update_hash
((
void
*
)
&
save_result
.
vint
,
sizeof
(
save_result
.
vint
),
res
=
update_hash
((
void
*
)
&
save_result
.
vint
,
sizeof
(
save_result
.
vint
),
INT_RESULT
,
&
my_charset_bin
,
DERIVATION_IMPLICIT
,
INT_RESULT
,
&
my_charset_bin
,
DERIVATION_IMPLICIT
);
unsigned_flag
);
break
;
break
;
}
}
case
STRING_RESULT
:
case
STRING_RESULT
:
{
{
if
(
!
save_result
.
vstr
)
// Null value
if
(
!
save_result
.
vstr
)
// Null value
res
=
update_hash
((
void
*
)
0
,
0
,
STRING_RESULT
,
&
my_charset_bin
,
res
=
update_hash
((
void
*
)
0
,
0
,
STRING_RESULT
,
&
my_charset_bin
,
DERIVATION_IMPLICIT
,
0
);
DERIVATION_IMPLICIT
);
else
else
res
=
update_hash
((
void
*
)
save_result
.
vstr
->
ptr
(),
res
=
update_hash
((
void
*
)
save_result
.
vstr
->
ptr
(),
save_result
.
vstr
->
length
(),
STRING_RESULT
,
save_result
.
vstr
->
length
(),
STRING_RESULT
,
save_result
.
vstr
->
charset
(),
save_result
.
vstr
->
charset
(),
DERIVATION_IMPLICIT
,
0
);
DERIVATION_IMPLICIT
);
break
;
break
;
}
}
case
ROW_RESULT
:
case
ROW_RESULT
:
...
...
sql/item_func.h
View file @
27fae2cb
...
@@ -961,7 +961,7 @@ public:
...
@@ -961,7 +961,7 @@ public:
longlong
val_int
();
longlong
val_int
();
String
*
val_str
(
String
*
str
);
String
*
val_str
(
String
*
str
);
bool
update_hash
(
void
*
ptr
,
uint
length
,
enum
Item_result
type
,
bool
update_hash
(
void
*
ptr
,
uint
length
,
enum
Item_result
type
,
CHARSET_INFO
*
cs
,
Derivation
dv
,
bool
unsigned_arg
);
CHARSET_INFO
*
cs
,
Derivation
dv
);
bool
check
();
bool
check
();
bool
update
();
bool
update
();
enum
Item_result
result_type
()
const
{
return
cached_result_type
;
}
enum
Item_result
result_type
()
const
{
return
cached_result_type
;
}
...
...
sql/log_event.cc
View file @
27fae2cb
...
@@ -2607,7 +2607,7 @@ int User_var_log_event::exec_event(struct st_relay_log_info* rli)
...
@@ -2607,7 +2607,7 @@ int User_var_log_event::exec_event(struct st_relay_log_info* rli)
a single record and with a single column. Thus, like
a single record and with a single column. Thus, like
a column value, it could always have IMPLICIT derivation.
a column value, it could always have IMPLICIT derivation.
*/
*/
e
.
update_hash
(
val
,
val_len
,
type
,
charset
,
DERIVATION_IMPLICIT
,
0
);
e
.
update_hash
(
val
,
val_len
,
type
,
charset
,
DERIVATION_IMPLICIT
);
free_root
(
thd
->
mem_root
,
0
);
free_root
(
thd
->
mem_root
,
0
);
rli
->
inc_event_relay_log_pos
(
get_event_len
());
rli
->
inc_event_relay_log_pos
(
get_event_len
());
...
...
sql/sql_class.h
View file @
27fae2cb
...
@@ -1464,7 +1464,6 @@ class user_var_entry
...
@@ -1464,7 +1464,6 @@ class user_var_entry
char
*
value
;
char
*
value
;
ulong
length
,
update_query_id
,
used_query_id
;
ulong
length
,
update_query_id
,
used_query_id
;
Item_result
type
;
Item_result
type
;
bool
unsigned_flag
;
double
val
(
my_bool
*
null_value
);
double
val
(
my_bool
*
null_value
);
longlong
val_int
(
my_bool
*
null_value
);
longlong
val_int
(
my_bool
*
null_value
);
...
...
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