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
e30b6a98
Commit
e30b6a98
authored
Oct 06, 2017
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-11819 NO_ZERO_IN_DATE: Incorrect generated column value
parent
bea99275
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
78 additions
and
1 deletion
+78
-1
mysql-test/r/func_time.result
mysql-test/r/func_time.result
+14
-0
mysql-test/suite/vcol/r/vcol_misc.result
mysql-test/suite/vcol/r/vcol_misc.result
+19
-0
mysql-test/suite/vcol/t/vcol_misc.test
mysql-test/suite/vcol/t/vcol_misc.test
+20
-0
mysql-test/t/func_time.test
mysql-test/t/func_time.test
+16
-0
sql/item_timefunc.h
sql/item_timefunc.h
+9
-1
No files found.
mysql-test/r/func_time.result
View file @
e30b6a98
...
...
@@ -2626,3 +2626,17 @@ DROP TABLE t1;
SELECT 1 MOD ADDTIME( '13:58:57', '00:00:01' ) + 2;
1 MOD ADDTIME( '13:58:57', '00:00:01' ) + 2
3
#
# MDEV-11819 NO_ZERO_IN_DATE: Incorrect generated column value
#
SET sql_mode='NO_ZERO_IN_DATE';
CREATE TABLE t1 (a TIME(6));
INSERT INTO t1 SELECT timediff(timestamp'2008-12-31 23:59:59.000001',timestamp'2008-12-30 01:01:01.000002');
SELECT * FROM t1;
a
46:58:57.999999
DROP TABLE t1;
SET sql_mode=DEFAULT;
#
# End of 5.5 tests
#
mysql-test/suite/vcol/r/vcol_misc.result
View file @
e30b6a98
...
...
@@ -337,3 +337,22 @@ tsv timestamp as (adddate(ts, interval 1 day)) virtual
);
drop table t1;
set sql_mode=default;
#
# MDEV-11819 NO_ZERO_IN_DATE: Incorrect generated column value
#
SET sql_mode='NO_ZERO_IN_DATE';
CREATE TABLE t1
(
a datetime DEFAULT NULL,
b datetime DEFAULT NULL,
c time GENERATED ALWAYS AS (timediff(`a`,`b`)) VIRTUAL
);
INSERT INTO t1 VALUES ('2008-12-31 23:59:59.000001','2008-12-30 01:01:01.000002',DEFAULT);
SELECT * FROM t1;
a b c
2008-12-31 23:59:59 2008-12-30 01:01:01 46:58:58
DROP TABLE t1;
SET sql_mode=DEFAULT;
#
# End of 5.5 tests
#
mysql-test/suite/vcol/t/vcol_misc.test
View file @
e30b6a98
...
...
@@ -301,3 +301,23 @@ create table t1 (
);
drop
table
t1
;
set
sql_mode
=
default
;
--
echo
#
--
echo
# MDEV-11819 NO_ZERO_IN_DATE: Incorrect generated column value
--
echo
#
SET
sql_mode
=
'NO_ZERO_IN_DATE'
;
CREATE
TABLE
t1
(
a
datetime
DEFAULT
NULL
,
b
datetime
DEFAULT
NULL
,
c
time
GENERATED
ALWAYS
AS
(
timediff
(
`a`
,
`b`
))
VIRTUAL
);
INSERT
INTO
t1
VALUES
(
'2008-12-31 23:59:59.000001'
,
'2008-12-30 01:01:01.000002'
,
DEFAULT
);
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
SET
sql_mode
=
DEFAULT
;
--
echo
#
--
echo
# End of 5.5 tests
--
echo
#
mysql-test/t/func_time.test
View file @
e30b6a98
...
...
@@ -1602,3 +1602,19 @@ DROP TABLE t1;
--
echo
# MDEV-10524 Assertion `arg1_int >= 0' failed in Item_func_additive_op::result_precision()
--
echo
#
SELECT
1
MOD
ADDTIME
(
'13:58:57'
,
'00:00:01'
)
+
2
;
--
echo
#
--
echo
# MDEV-11819 NO_ZERO_IN_DATE: Incorrect generated column value
--
echo
#
SET
sql_mode
=
'NO_ZERO_IN_DATE'
;
CREATE
TABLE
t1
(
a
TIME
(
6
));
INSERT
INTO
t1
SELECT
timediff
(
timestamp
'2008-12-31 23:59:59.000001'
,
timestamp
'2008-12-30 01:01:01.000002'
);
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
SET
sql_mode
=
DEFAULT
;
--
echo
#
--
echo
# End of 5.5 tests
--
echo
#
sql/item_timefunc.h
View file @
e30b6a98
...
...
@@ -500,8 +500,16 @@ class Item_temporal_func: public Item_func
{
return
val_decimal_from_date
(
decimal_value
);
}
Field
*
tmp_table_field
(
TABLE
*
table
)
{
return
tmp_table_field_from_field_type
(
table
,
0
);
}
#if MARIADB_VERSION_ID > 100300
#error This code should be removed in 10.3, to use the derived save_in_field()
#else
int
save_in_field
(
Field
*
field
,
bool
no_conversions
)
{
return
save_date_in_field
(
field
);
}
{
return
field_type
()
==
MYSQL_TYPE_TIME
?
save_time_in_field
(
field
)
:
save_date_in_field
(
field
);
}
#endif
void
fix_length_and_dec
();
};
...
...
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