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
82a0b8ae
Commit
82a0b8ae
authored
Jul 02, 2013
by
Michael Widenius
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
strict.test now works.
parent
99aae21e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
56 additions
and
9 deletions
+56
-9
mysql-test/r/bootstrap.result
mysql-test/r/bootstrap.result
+1
-1
mysql-test/r/strict.result
mysql-test/r/strict.result
+28
-3
mysql-test/t/strict.test
mysql-test/t/strict.test
+20
-0
sql/item.cc
sql/item.cc
+2
-2
sql/item_timefunc.cc
sql/item_timefunc.cc
+4
-2
sql/sql_class.h
sql/sql_class.h
+1
-1
No files found.
mysql-test/r/bootstrap.result
View file @
82a0b8ae
drop table if exists t1;
drop table t1;
drop table t1;
ERROR 42S02: Unknown table 't1'
ERROR 42S02: Unknown table 't
est.t
1'
set @my_max_allowed_packet= @@max_allowed_packet;
set global max_allowed_packet=100*@@max_allowed_packet;
set global max_allowed_packet=@my_max_allowed_packet;
...
...
mysql-test/r/strict.result
View file @
82a0b8ae
...
...
@@ -793,7 +793,7 @@ INSERT INTO t1 (col1) VALUES ('1a');
ERROR 22007: Incorrect decimal value: '1a' for column 'col1' at row 1
INSERT IGNORE INTO t1 (col1) VALUES ('2a');
Warnings:
Note
1265 Data truncated for column 'col1' at row 1
Warning
1265 Data truncated for column 'col1' at row 1
INSERT IGNORE INTO t1 values (1/0);
Warnings:
Warning 1365 Division by 0
...
...
@@ -1190,8 +1190,6 @@ select'a'; insert into t1 values (200); end;|
call t1();
a
a
Warnings:
Error 1264 Out of range value for column 'col1' at row 1
select * from t1;
col1
drop procedure t1;
...
...
@@ -1501,3 +1499,30 @@ count(*)
0
drop table t1;
End of 5.0 tests
#
# Start of 5.6 tests
#
#
# WL#946 TIME/TIMESTAMP/DATETIME with fractional seconds: CAST to DATETIME
#
#
# STR_TO_DATE with NO_ZERO_DATE did not return NULL (with warning)
# in get_date(). Only did in val_str() and val_int().
SET sql_mode='NO_ZERO_DATE';
SELECT STR_TO_DATE('2001','%Y'),CONCAT(STR_TO_DATE('2001','%Y')), STR_TO_DATE('2001','%Y')+1, STR_TO_DATE('0','%Y')+1, STR_TO_DATE('0000','%Y')+1;
STR_TO_DATE('2001','%Y') CONCAT(STR_TO_DATE('2001','%Y')) STR_TO_DATE('2001','%Y')+1 STR_TO_DATE('0','%Y')+1 STR_TO_DATE('0000','%Y')+1
2001-00-00 2001-00-00 20010001 20000001 NULL
Warnings:
Warning 1411 Incorrect datetime value: '0000' for function str_to_date
SET sql_mode='NO_ZERO_IN_DATE';
SELECT STR_TO_DATE('2001','%Y'),CONCAT(STR_TO_DATE('2001','%Y')), STR_TO_DATE('2001','%Y')+1, STR_TO_DATE('0000','%Y')+1;
STR_TO_DATE('2001','%Y') CONCAT(STR_TO_DATE('2001','%Y')) STR_TO_DATE('2001','%Y')+1 STR_TO_DATE('0000','%Y')+1
NULL NULL NULL NULL
Warnings:
Warning 1411 Incorrect datetime value: '2001' for function str_to_date
Warning 1411 Incorrect datetime value: '2001' for function str_to_date
Warning 1411 Incorrect datetime value: '2001' for function str_to_date
Warning 1411 Incorrect datetime value: '0000' for function str_to_date
#
# End of 5.6 tests
#
mysql-test/t/strict.test
View file @
82a0b8ae
...
...
@@ -1350,3 +1350,23 @@ select count(*) from t1 where a is null;
drop
table
t1
;
--
echo
End
of
5.0
tests
--
echo
#
--
echo
# Start of 5.6 tests
--
echo
#
--
echo
#
--
echo
# WL#946 TIME/TIMESTAMP/DATETIME with fractional seconds: CAST to DATETIME
--
echo
#
--
echo
#
--
echo
# STR_TO_DATE with NO_ZERO_DATE did not return NULL (with warning)
--
echo
# in get_date(). Only did in val_str() and val_int().
SET
sql_mode
=
'NO_ZERO_DATE'
;
SELECT
STR_TO_DATE
(
'2001'
,
'%Y'
),
CONCAT
(
STR_TO_DATE
(
'2001'
,
'%Y'
)),
STR_TO_DATE
(
'2001'
,
'%Y'
)
+
1
,
STR_TO_DATE
(
'0'
,
'%Y'
)
+
1
,
STR_TO_DATE
(
'0000'
,
'%Y'
)
+
1
;
SET
sql_mode
=
'NO_ZERO_IN_DATE'
;
SELECT
STR_TO_DATE
(
'2001'
,
'%Y'
),
CONCAT
(
STR_TO_DATE
(
'2001'
,
'%Y'
)),
STR_TO_DATE
(
'2001'
,
'%Y'
)
+
1
,
STR_TO_DATE
(
'0000'
,
'%Y'
)
+
1
;
--
echo
#
--
echo
# End of 5.6 tests
--
echo
#
sql/item.cc
View file @
82a0b8ae
...
...
@@ -297,7 +297,7 @@ String *Item::val_string_from_decimal(String *str)
String
*
Item
::
val_string_from_date
(
String
*
str
)
{
MYSQL_TIME
ltime
;
if
(
get_date
(
&
ltime
,
TIME_FUZZY_DATE
)
||
if
(
get_date
(
&
ltime
,
TIME_FUZZY_DATE
|
sql_mode_for_dates
()
)
||
str
->
alloc
(
MAX_DATE_STRING_REP_LENGTH
))
{
null_value
=
1
;
...
...
@@ -354,7 +354,7 @@ my_decimal *Item::val_decimal_from_date(my_decimal *decimal_value)
{
DBUG_ASSERT
(
fixed
==
1
);
MYSQL_TIME
ltime
;
if
(
get_date
(
&
ltime
,
TIME_FUZZY_DATE
))
if
(
get_date
(
&
ltime
,
TIME_FUZZY_DATE
|
sql_mode_for_dates
()
))
{
my_decimal_set_zero
(
decimal_value
);
null_value
=
1
;
// set NULL, stop processing
...
...
sql/item_timefunc.cc
View file @
82a0b8ae
...
...
@@ -415,8 +415,10 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
l_time
->
minute
>
59
||
l_time
->
second
>
59
)
goto
err
;
if
((
fuzzy_date
&
TIME_NO_ZERO_DATE
)
&&
(
l_time
->
year
==
0
||
l_time
->
month
==
0
||
l_time
->
day
==
0
))
if
(((
fuzzy_date
&
TIME_NO_ZERO_IN_DATE
)
&&
(
l_time
->
year
==
0
||
l_time
->
month
==
0
||
l_time
->
day
==
0
))
||
(
fuzzy_date
&
TIME_NO_ZERO_DATE
)
&&
(
l_time
->
year
==
0
&&
l_time
->
month
==
0
&&
l_time
->
day
==
0
))
goto
err
;
if
(
val
!=
val_end
)
...
...
sql/sql_class.h
View file @
82a0b8ae
...
...
@@ -3417,7 +3417,7 @@ my_eof(THD *thd)
checking for all date handling.
*/
const
my_bool
strict_date_checking
=
0
;
const
my_bool
strict_date_checking
=
1
;
inline
sql_mode_t
sql_mode_for_dates
(
THD
*
thd
)
{
...
...
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