Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-15218

Confusing warning when using datetimes with year>9999 in the binary protocol

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 10.2, 10.3
    • 10.4
    • Temporal Types
    • 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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            bar Alexander Barkov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.