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

Backslash makes prepared statements and normal statements have different results

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Not a Bug
    • None
    • N/A
    • Parser
    • None
    • Not for Release Notes

    Description

      Hi,

      In the following test case, a backslash is used in the query. In the normal query, the \' will be transformed to a single quote, which is different from the single quote that was used to include the string; however, in the prepared query, the \' is transformed to a single quote that is the same as the one used to include the string. The two equivalent queries have different results.

      CREATE TABLE t0(c0 DOUBLE);
      REPLACE INTO t0 VALUES (0.5);
      SELECT t0.c0 FROM t0 WHERE '1\'#' AND FALSE; – empty result
      PREPARE prepare_query FROM "SELECT t0.c0 FROM t0 WHERE '1\'#' AND FALSE";
      EXECUTE prepare_query; – 0.5

      Attachments

        Activity

          People

            knielsen Kristian Nielsen
            ChiZhang Chi Zhang
            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.