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

DATE('string') incompability between mysql and mariadb

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 5.5.31, 5.3.12
    • Fix Version/s: 10.0.5, 5.5.32, 5.3.13
    • Component/s: None
    • Labels:
      None

      Description

      If you do SELECT date('string'); in MySQL you get NULL and if you do the same in MariaDB you get '0000-00-00';

      Tried with MySQL ver 5.1.29, probably with all previous versions.
      Perhaps it is a known change, but it's hard to search for

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            elenst Elena Stepanova added a comment -

            We had various similar issues, since NULL vs 0000-00-00 inconsistency is all over the place, even inside the same version (e.g. compare DATE('string') and FROM_DAYS('string') in MySQL). However, I haven't found this exact problem, so I'm passing it over to Sergei for a verdict. If it's intentional, maybe we should document it here https://kb.askmonty.org/en/date-function/ , the same way as error handling is documented at https://kb.askmonty.org/en/unix_timestamp/.

            CAST has the same difference:

            MySQL:
            CAST('string' AS DATE)
            NULL

            MariaDB:
            CAST('string' AS DATE)
            0000-00-00

            Show
            elenst Elena Stepanova added a comment - We had various similar issues, since NULL vs 0000-00-00 inconsistency is all over the place, even inside the same version (e.g. compare DATE('string') and FROM_DAYS('string') in MySQL). However, I haven't found this exact problem, so I'm passing it over to Sergei for a verdict. If it's intentional, maybe we should document it here https://kb.askmonty.org/en/date-function/ , the same way as error handling is documented at https://kb.askmonty.org/en/unix_timestamp/ . CAST has the same difference: MySQL: CAST('string' AS DATE) NULL MariaDB: CAST('string' AS DATE) 0000-00-00

              People

              • Assignee:
                serg Sergei Golubchik
                Reporter:
                jorenu Jonas Reinhardt
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 6 hours
                  6h