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

STR_TO_DATE fails to return null in procedure

    XMLWordPrintable

Details

    Description

      Calling a simple function which uses STR_TO_DATE twice to safely return a date produces an error while the same code run as a select produces (the expected) warning.

      DELIMITER $$
      CREATE DEFINER=`root`@`localhost` FUNCTION `safe_date`(`date_str` VARCHAR(30)) RETURNS datetime
          NO SQL
          DETERMINISTIC
      return COALESCE(STR_TO_DATE(date_str,'%d/%m/%Y'),STR_TO_DATE(date_str,'%Y-%m-%d'))$$
      DELIMITER ;
      

      Attachments

        Activity

          People

            bar Alexander Barkov
            fraganestis.a Anestis Fraganestis
            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.