[MDEV-31516] Cursor protocol gives incorrect result with sql_mode='ALLOW_INVALID_DATES' Created: 2023-06-21  Updated: 2023-11-28

Status: Open
Project: MariaDB Server
Component/s: None
Affects Version/s: 10.4, 10.5, 10.6, 10.9, 10.10, 11.0, 11.1, 11.2
Fix Version/s: 10.4, 10.5, 10.6, 11.0, 11.1, 11.2

Type: Bug Priority: Major
Reporter: Lena Startseva Assignee: Oleksandr Byelkin
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-31005 Make working cursor-protocol Stalled

 Description   

Cursor protocol gives incorrect result with sql_mode='ALLOW_INVALID_DATES'- invalid dates are replaced with "0000-00-00" , but it is important for repeating that after inserting invalid date to set sql_mode='ansi,traditional' and insert correct date:

Testcase:

CREATE TABLE t1 (col1 date);
 
set @@sql_mode='STRICT_ALL_TABLES,ALLOW_INVALID_DATES';
INSERT INTO t1 VALUES ('2004-2-30');
 
set @@sql_mode='ansi,traditional';
INSERT IGNORE INTO t1 VALUES('2004-02-29');
 
select * from t1;
drop table t1;

Expected value:

col1
2004-02-30
2004-02-29

Actual value:

col1
0000-00-00
2004-02-29


Generated at Thu Feb 08 10:24:28 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.