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

TO_DATE: TO_CHAR with new ISO 8601 year format elements sometimes returns NULL without warnings

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • N/A
    • 12.3
    • Server
    • None

    Description

      bb-12.3-MDEV-19683-to_date d5fb3dccd72d816c7181a069b91eedb3c76b2715

      MariaDB [test]> select to_char(now(), 'IYYYYYYY');
      +----------------------------+
      | to_char(now(), 'IYYYYYYY') |
      +----------------------------+
      | NULL                       |
      +----------------------------+
      1 row in set (0.001 sec)
      

      The expectation is that it would work, as in other similar situations, greedily parsing the format string as IYYY followed by YYYY. It works in Oracle

      Oracle 21c

      select to_char(to_date('2026','YYYY'), 'IYYYYYYY') as x from dual;
       
      X
      20262026
      

      and also in MariaDB with other elements, e.g.:

      MariaDB [test]> select to_char(now(), 'SYYYYYYYY') as x from dual;
      +----------+
      | x        |
      +----------+
      | 20262026 |
      +----------+
      1 row in set (0.001 sec)
      

      Attachments

        Issue Links

          Activity

            People

              elenst Elena Stepanova
              elenst Elena Stepanova
              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.