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
fbdf00f0
Commit
fbdf00f0
authored
Sep 28, 2007
by
gkodinov/kgeorge@magare.gmz
Browse files
Options
Browse Files
Download
Plain Diff
Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into magare.gmz:/home/kgeorge/mysql/autopush/B30587-5.0-opt
parents
2a26db1f
aa2d545d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
78 additions
and
1 deletion
+78
-1
mysql-test/r/func_math.result
mysql-test/r/func_math.result
+46
-0
mysql-test/t/func_math.test
mysql-test/t/func_math.test
+27
-0
sql/item_func.cc
sql/item_func.cc
+5
-1
No files found.
mysql-test/r/func_math.result
View file @
fbdf00f0
...
...
@@ -322,4 +322,50 @@ mod(5, cast(-2 as unsigned)) mod(5, 18446744073709551614) mod(5, -2)
select pow(cast(-2 as unsigned), 5), pow(18446744073709551614, 5), pow(-2, 5);
pow(cast(-2 as unsigned), 5) pow(18446744073709551614, 5) pow(-2, 5)
2.1359870359209e+96 2.1359870359209e+96 -32
CREATE TABLE t1 (a timestamp, b varchar(20), c bit(1));
INSERT INTO t1 VALUES('1998-09-23', 'str1', 1), ('2003-03-25', 'str2', 0);
SELECT a DIV 900 y FROM t1 GROUP BY y;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def y y 8 19 11 Y 32800 0 63
y
22201025555
22255916666
SELECT DISTINCT a DIV 900 y FROM t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def y y 8 19 11 Y 32800 0 63
y
22201025555
22255916666
SELECT b DIV 900 y FROM t1 GROUP BY y;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def y y 8 20 1 Y 32768 0 63
y
0
SELECT c DIV 900 y FROM t1 GROUP BY y;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def y y 3 1 1 Y 32800 0 63
y
0
DROP TABLE t1;
CREATE TABLE t1(a LONGBLOB);
INSERT INTO t1 VALUES('1'),('2'),('3');
SELECT DISTINCT (a DIV 254576881) FROM t1;
(a DIV 254576881)
0
SELECT (a DIV 254576881) FROM t1 UNION ALL
SELECT (a DIV 254576881) FROM t1;
(a DIV 254576881)
0
0
0
0
0
0
DROP TABLE t1;
CREATE TABLE t1(a SET('a','b','c'));
INSERT INTO t1 VALUES ('a');
SELECT a DIV 2 FROM t1 UNION SELECT a DIV 2 FROM t1;
a DIV 2
0
DROP TABLE t1;
End of 5.0 tests
mysql-test/t/func_math.test
View file @
fbdf00f0
...
...
@@ -205,4 +205,31 @@ select mod(cast(-2 as unsigned), 3), mod(18446744073709551614, 3), mod(-2, 3);
select
mod
(
5
,
cast
(
-
2
as
unsigned
)),
mod
(
5
,
18446744073709551614
),
mod
(
5
,
-
2
);
select
pow
(
cast
(
-
2
as
unsigned
),
5
),
pow
(
18446744073709551614
,
5
),
pow
(
-
2
,
5
);
#
# Bug #30587: mysql crashes when trying to group by TIME div NUMBER
#
CREATE
TABLE
t1
(
a
timestamp
,
b
varchar
(
20
),
c
bit
(
1
));
INSERT
INTO
t1
VALUES
(
'1998-09-23'
,
'str1'
,
1
),
(
'2003-03-25'
,
'str2'
,
0
);
--
enable_metadata
SELECT
a
DIV
900
y
FROM
t1
GROUP
BY
y
;
SELECT
DISTINCT
a
DIV
900
y
FROM
t1
;
SELECT
b
DIV
900
y
FROM
t1
GROUP
BY
y
;
SELECT
c
DIV
900
y
FROM
t1
GROUP
BY
y
;
--
disable_metadata
DROP
TABLE
t1
;
CREATE
TABLE
t1
(
a
LONGBLOB
);
INSERT
INTO
t1
VALUES
(
'1'
),(
'2'
),(
'3'
);
SELECT
DISTINCT
(
a
DIV
254576881
)
FROM
t1
;
SELECT
(
a
DIV
254576881
)
FROM
t1
UNION
ALL
SELECT
(
a
DIV
254576881
)
FROM
t1
;
DROP
TABLE
t1
;
CREATE
TABLE
t1
(
a
SET
(
'a'
,
'b'
,
'c'
));
INSERT
INTO
t1
VALUES
(
'a'
);
SELECT
a
DIV
2
FROM
t1
UNION
SELECT
a
DIV
2
FROM
t1
;
DROP
TABLE
t1
;
--
echo
End
of
5.0
tests
sql/item_func.cc
View file @
fbdf00f0
...
...
@@ -1380,7 +1380,11 @@ longlong Item_func_int_div::val_int()
void
Item_func_int_div
::
fix_length_and_dec
()
{
max_length
=
args
[
0
]
->
max_length
-
args
[
0
]
->
decimals
;
Item_result
argtype
=
args
[
0
]
->
result_type
();
/* use precision ony for the data type it is applicable for and valid */
max_length
=
args
[
0
]
->
max_length
-
(
argtype
==
DECIMAL_RESULT
||
argtype
==
INT_RESULT
?
args
[
0
]
->
decimals
:
0
);
maybe_null
=
1
;
unsigned_flag
=
args
[
0
]
->
unsigned_flag
|
args
[
1
]
->
unsigned_flag
;
}
...
...
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