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

str_to_date option not properly escaped

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.1.22
    • N/A
    • Documentation
    • None

    Description

      https://mariadb.com/kb/en/mariadb/date_format/

      On this page, the format options "#", "." and "@" seems to have been quoted with a typo. They should appear as "%#", "%." and "%@" respectively.

      We sample tested the below expression - SELECT STR_TO_DATE('Wednesday, June 2, 2014', '%W, %M %e, %Y'), with and without "%" prefix for the above options. The expressions without "%" prefix gave NULL.

      SELECT STR_TO_DATE('Wednesday23423, June 2, 2014', '%W#, %M %e, %Y'); printed NULL
      SELECT STR_TO_DATE('Wednesday, June 2, sfsfsf2014', '%W, %M %e, @%Y'); printed NULL
      SELECT STR_TO_DATE('Wednesday,##$#$ June 2, 2014', '%W, . %M %e, %Y'); printed NULL
      Where as below expressions, with % prefix on above options, worked perfectly well and as per option description provided on the documentation page.

      SELECT STR_TO_DATE('Wednesday23423, June 2, 2014', '%W%#, %M %e, %Y'); printed 2014-06-02
      SELECT STR_TO_DATE('Wednesday, June 2, sfsfsf2014', '%W, %M %e, %@%Y'); printed 2014-06-02
      SELECT STR_TO_DATE('Wednesday,##$#$ June 2, 2014', '%W, %. %M %e, %Y'); printed 2014-06-02
      So these three options seem to filter out the undesirable ch from a particular date component. Please confirm.

      Attachments

        Activity

          People

            greenman Ian Gilfillan
            ashwing Ashwin Gopalakrishnan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

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