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
0a14d1a1
Commit
0a14d1a1
authored
Oct 23, 2007
by
gkodinov/kgeorge@magare.gmz
Browse files
Options
Browse Files
Download
Plain Diff
Merge magare.gmz:/home/kgeorge/mysql/work/B28687-5.0-opt
into magare.gmz:/home/kgeorge/mysql/work/B28687-5.1-opt
parents
9e6091fc
52b35112
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
0 deletions
+62
-0
mysql-test/r/type_date.result
mysql-test/r/type_date.result
+39
-0
mysql-test/t/type_date.test
mysql-test/t/type_date.test
+20
-0
sql/item.cc
sql/item.cc
+3
-0
No files found.
mysql-test/r/type_date.result
View file @
0a14d1a1
...
...
@@ -184,4 +184,43 @@ EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW();
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
DROP TABLE t1;
CREATE TABLE t1 (a DATE);
CREATE TABLE t2 (a DATE);
CREATE INDEX i ON t1 (a);
INSERT INTO t1 VALUES ('0000-00-00'),('0000-00-00');
INSERT INTO t2 VALUES ('0000-00-00'),('0000-00-00');
SELECT * FROM t1 WHERE a = '0000-00-00';
a
0000-00-00
0000-00-00
SELECT * FROM t2 WHERE a = '0000-00-00';
a
0000-00-00
0000-00-00
SET SQL_MODE=TRADITIONAL;
EXPLAIN SELECT * FROM t1 WHERE a = '0000-00-00';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref i i 4 const 1 Using where; Using index
Warnings:
Warning 1292 Incorrect date value: '0000-00-00' for column 'a' at row 1
Warning 1292 Incorrect date value: '0000-00-00' for column 'a' at row 1
SELECT * FROM t1 WHERE a = '0000-00-00';
a
0000-00-00
0000-00-00
Warnings:
Warning 1292 Incorrect date value: '0000-00-00' for column 'a' at row 1
Warning 1292 Incorrect date value: '0000-00-00' for column 'a' at row 1
Warning 1292 Incorrect date value: '0000-00-00' for column 'a' at row 1
SELECT * FROM t2 WHERE a = '0000-00-00';
a
0000-00-00
0000-00-00
Warnings:
Warning 1292 Incorrect date value: '0000-00-00' for column 'a' at row 1
Warning 1292 Incorrect date value: '0000-00-00' for column 'a' at row 1
INSERT INTO t1 VALUES ('0000-00-00');
ERROR 22007: Incorrect date value: '0000-00-00' for column 'a' at row 1
SET SQL_MODE=DEFAULT;
DROP TABLE t1,t2;
End of 5.0 tests
mysql-test/t/type_date.test
View file @
0a14d1a1
...
...
@@ -173,4 +173,24 @@ EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW();
DROP
TABLE
t1
;
#
# Bug #28687: Search fails on '0000-00-00' date after sql_mode change
#
CREATE
TABLE
t1
(
a
DATE
);
CREATE
TABLE
t2
(
a
DATE
);
CREATE
INDEX
i
ON
t1
(
a
);
INSERT
INTO
t1
VALUES
(
'0000-00-00'
),(
'0000-00-00'
);
INSERT
INTO
t2
VALUES
(
'0000-00-00'
),(
'0000-00-00'
);
SELECT
*
FROM
t1
WHERE
a
=
'0000-00-00'
;
SELECT
*
FROM
t2
WHERE
a
=
'0000-00-00'
;
SET
SQL_MODE
=
TRADITIONAL
;
EXPLAIN
SELECT
*
FROM
t1
WHERE
a
=
'0000-00-00'
;
SELECT
*
FROM
t1
WHERE
a
=
'0000-00-00'
;
SELECT
*
FROM
t2
WHERE
a
=
'0000-00-00'
;
--
error
ER_TRUNCATED_WRONG_VALUE
INSERT
INTO
t1
VALUES
(
'0000-00-00'
);
SET
SQL_MODE
=
DEFAULT
;
DROP
TABLE
t1
,
t2
;
--
echo
End
of
5.0
tests
sql/item.cc
View file @
0a14d1a1
...
...
@@ -966,10 +966,13 @@ int Item::save_in_field_no_warnings(Field *field, bool no_conversions)
THD
*
thd
=
table
->
in_use
;
enum_check_fields
tmp
=
thd
->
count_cuted_fields
;
my_bitmap_map
*
old_map
=
dbug_tmp_use_all_columns
(
table
,
table
->
write_set
);
ulong
sql_mode
=
thd
->
variables
.
sql_mode
;
thd
->
variables
.
sql_mode
&=
~
(
MODE_NO_ZERO_IN_DATE
|
MODE_NO_ZERO_DATE
);
thd
->
count_cuted_fields
=
CHECK_FIELD_IGNORE
;
res
=
save_in_field
(
field
,
no_conversions
);
thd
->
count_cuted_fields
=
tmp
;
dbug_tmp_restore_column_map
(
table
->
write_set
,
old_map
);
thd
->
variables
.
sql_mode
=
sql_mode
;
return
res
;
}
...
...
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