[MDEV-15218] Confusing warning when using datetimes with year>9999 in the binary protocol Created: 2018-02-06  Updated: 2023-04-27

Status: Open
Project: MariaDB Server
Component/s: Temporal Types
Affects Version/s: 10.2, 10.3
Fix Version/s: 10.4

Type: Bug Priority: Minor
Reporter: Alexander Barkov Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


 Description   

I run the client test against a running server:

./mysql_client_test -uroot test_datetime_ranges

#####################################
1 of (1/1): test_datetime_ranges  
#####################################
 
 total parameters in stmt: `6` (expected: `6`)
 total warnings: 6 (expected: 6)
 
	+---------+------+-----------------------------------------------------------+
	| Level   | Code | Message                                                   |
	+---------+------+-----------------------------------------------------------+
	| Warning | 1292 | Truncated incorrect datetime value: '0000-11-10 12:30:30' |	
	| Warning | 1292 | Truncated incorrect datetime value: '2004-13-10 12:30:30' |	
	| Warning | 1292 | Truncated incorrect datetime value: '2004-11-32 12:30:30' |	
	| Warning | 1292 | Truncated incorrect datetime value: '2004-11-10 24:30:30' |	
	| Warning | 1292 | Truncated incorrect datetime value: '2004-11-10 12:60:30' |	
	| Warning | 1292 | Truncated incorrect datetime value: '2004-11-10 12:30:60' |	
	+---------+------+-----------------------------------------------------------+
 
	6 rows returned

Notice, the first warning said '0000-11-10 12:30:30'. This is misleading.

The bound value was actually '10000-11-10 12:30:30'. The relevant code in mysql_client_test.cc is:

static void test_datetime_ranges()
{
  ...
  tm[0].year= 10000;  tm[1].month= 13; tm[2].day= 32;

It should be fixed to produce a correct warning.


Generated at Thu Feb 08 08:19:34 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.