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

TO_DATE: Quotation for multi-word NLS_DATE_LANGUAGE leads to syntax error in view definition

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • N/A
    • 12.3.1
    • Views
    • None
    • Not for Release Notes
    • Fix pushed

    Description

      CREATE VIEW v AS SELECT TO_DATE('2026-01 MAIO,SEXTA-FEIRA', 'YYYY-DD MONTH, DAY','NLS_DATE_LANGUAGE=''BRAZILIAN PORTUGUESE''') AS f;
      SHOW CREATE VIEW v;
       
      DROP VIEW v;
      

      bb-12.3-MDEV-19683-to_date 7eaeefd23c4863045893e9e13c144fbfe1ba2fea

      mysqltest: At line 2: query 'SHOW CREATE VIEW v' failed: ER_PARSE_ERROR (1064): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'BRAZILIAN PORTUGUESE'') AS `f`' at line 1
      

      The frm is

      TYPE=VIEW
      query=select to_date(\'2026-01 MAIO,SEXTA-FEIRA\',\'YYYY-DD MONTH, DAY\',\'NLS_DATE_LANGUAGE=\'BRAZILIAN PORTUGUESE\'\') AS `f`
      md5=8dd320f8f0b17a9c724b2197fc4ccd17
      updatable=0
      algorithm=0
      definer_user=root
      definer_host=localhost
      suid=2
      with_check_option=0
      timestamp=0001769701871420311
      create-version=2
      source=SELECT TO_DATE(\'2026-01 MAIO,SEXTA-FEIRA\', \'YYYY-DD MONTH, DAY\',\'NLS_DATE_LANGUAGE=\'\'BRAZILIAN PORTUGUESE\'\'\') AS f
      client_cs_name=latin1
      connection_cl_name=latin1_swedish_ci
      view_body_utf8=select to_date(\'2026-01 MAIO,SEXTA-FEIRA\',\'YYYY-DD MONTH, DAY\',\'NLS_DATE_LANGUAGE=\'BRAZILIAN PORTUGUESE\'\') AS `f`
      mariadb-version=120300
      

      Note that while using double quotes instead of two single quotes fixes the problem for MariaDB, it is incompatible with Oracle, which does not accept

      SELECT TO_DATE('2026-01 MAIO,SEXTA-FEIRA', 'YYYY-DD MONTH, DAY','NLS_DATE_LANGUAGE="BRAZILIAN PORTUGUESE"') AS f
      

      (at least not in any of two fiddles that I tried). It requires two single quotes, as in the test case.

      Attachments

        Issue Links

          Activity

            People

              monty Michael Widenius
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.