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
23809865
Commit
23809865
authored
Jul 26, 2010
by
Igor Babaev
Browse files
Options
Browse Files
Download
Plain Diff
Merge
parents
9ad14593
a7bc7ebd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
4 deletions
+42
-4
mysql-test/suite/vcol/r/vcol_misc.result
mysql-test/suite/vcol/r/vcol_misc.result
+20
-0
mysql-test/suite/vcol/t/vcol_misc.test
mysql-test/suite/vcol/t/vcol_misc.test
+16
-0
sql/item_func.cc
sql/item_func.cc
+6
-4
No files found.
mysql-test/suite/vcol/r/vcol_misc.result
View file @
23809865
...
...
@@ -105,3 +105,23 @@ t2 CREATE TABLE `t2` (
`v1` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2;
CREATE TABLE t1 (p int, a double NOT NULL, v double AS (ROUND(a,p)) VIRTUAL);
INSERT INTO t1 VALUES (0,1,0);
Warnings:
Warning 1645 The value specified for computed column 'v' in table 't1' ignored
INSERT INTO t1 VALUES (NULL,0,0);
Warnings:
Warning 1645 The value specified for computed column 'v' in table 't1' ignored
SELECT a, p, v, ROUND(a,p), ROUND(a,p+NULL) FROM t1;
a p v ROUND(a,p) ROUND(a,p+NULL)
1 0 1 1 NULL
0 NULL NULL NULL NULL
DROP TABLE t1;
CREATE TABLE t1 (p int, a double NOT NULL);
INSERT INTO t1(p,a) VALUES (0,1);
INSERT INTO t1(p,a) VALUES (NULL,0);
SELECT a, p, ROUND(a,p), ROUND(a,p+NULL) FROM t1;
a p ROUND(a,p) ROUND(a,p+NULL)
1 0 1 NULL
0 NULL NULL NULL
DROP TABLE t1;
mysql-test/suite/vcol/t/vcol_misc.test
View file @
23809865
...
...
@@ -112,3 +112,19 @@ CREATE TABLE t2 AS SELECT v1 FROM t1;
SHOW
CREATE
TABLE
t2
;
DROP
TABLE
t1
,
t2
;
#
# Bug#607177: ROUND function in the expression for a virtual function
#
CREATE
TABLE
t1
(
p
int
,
a
double
NOT
NULL
,
v
double
AS
(
ROUND
(
a
,
p
))
VIRTUAL
);
INSERT
INTO
t1
VALUES
(
0
,
1
,
0
);
INSERT
INTO
t1
VALUES
(
NULL
,
0
,
0
);
SELECT
a
,
p
,
v
,
ROUND
(
a
,
p
),
ROUND
(
a
,
p
+
NULL
)
FROM
t1
;
DROP
TABLE
t1
;
CREATE
TABLE
t1
(
p
int
,
a
double
NOT
NULL
);
INSERT
INTO
t1
(
p
,
a
)
VALUES
(
0
,
1
);
INSERT
INTO
t1
(
p
,
a
)
VALUES
(
NULL
,
0
);
SELECT
a
,
p
,
ROUND
(
a
,
p
),
ROUND
(
a
,
p
+
NULL
)
FROM
t1
;
DROP
TABLE
t1
;
sql/item_func.cc
View file @
23809865
...
...
@@ -2040,10 +2040,12 @@ double Item_func_round::real_op()
{
double
value
=
args
[
0
]
->
val_real
();
if
(
!
(
null_value
=
args
[
0
]
->
null_value
||
args
[
1
]
->
null_value
))
return
my_double_round
(
value
,
args
[
1
]
->
val_int
(),
args
[
1
]
->
unsigned_flag
,
truncate
);
if
(
!
(
null_value
=
args
[
0
]
->
null_value
))
{
longlong
dec
=
args
[
1
]
->
val_int
();
if
(
!
(
null_value
=
args
[
1
]
->
null_value
))
return
my_double_round
(
value
,
dec
,
args
[
1
]
->
unsigned_flag
,
truncate
);
}
return
0.0
;
}
...
...
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