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

Prepared statements with DATE literals do not honor NO_ZERO_IN_DATE

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.0.9
    • 10.0.11
    • None
    • None

    Description

      SET sql_mode=DEFAULT;
      PREPARE stmt FROM "SELECT (SELECT DATE'2001-00-00') AS c";
      EXECUTE stmt;
      SET sql_mode='no_zero_in_date';
      EXECUTE stmt;

      returns:

      +------------+
      | c          |
      +------------+
      | 2001-00-00 |
      +------------+
      1 row in set (0.00 sec)

      for both EXECUTE.
      This is wrong. The second EXECUTE should return NULL.

      If I change the script slightly:

      SET sql_mode=DEFAULT;
      PREPARE stmt FROM "SELECT (SELECT DATE('2001-00-00')) AS c";
      EXECUTE stmt;
      SET sql_mode='no_zero_in_date';
      EXECUTE stmt;

      it correctly returns '2001-00-00' for the first EXECUTE and NULL for the second EXECUTE,
      as expected.

      Attachments

        Activity

          People

            bar Alexander Barkov
            bar Alexander Barkov
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.