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

WITH ... AS ... prepared statements broken since 10.11.6

    XMLWordPrintable

Details

    Description

      Since 10.11.6 prepared statements are broken when using WITH ... AS ...

      Example in 10.11.5:

      prepare q FROM 'WITH t(id) AS (VALUES (?))
      SELECT t.id FROM t';
       
      SET @val = 1;
       
      EXECUTE q USING @val;
      

      Result:

      id
      1

      In 10.11.6 and above:

      prepare q FROM 'WITH t(id) AS (VALUES (?))
      SELECT t.id FROM t';
       
      SET @val = 1;
       
      EXECUTE q USING @val;
      

      Result:

      id
       

      Reproduction using docker:

      #10.11.5 -> works
      docker run --rm --name mariadb-test --env MARIADB_ROOT_PASSWORD=secret -d mariadb:10.11.5
      sleep 10
      docker exec -it mariadb-test mariadb -psecret -uroot --execute "prepare q FROM 'WITH t(id) AS (VALUES (?)) SELECT t.id FROM t'; SET @val = 1; EXECUTE q USING @val;"
      docker kill mariadb-test
       
      #10.11.6 -> broken
      docker run --rm --name mariadb-test --env MARIADB_ROOT_PASSWORD=secret -d mariadb:10.11.6
      sleep 10
      docker exec -it mariadb-test mariadb -psecret -uroot --execute "prepare q FROM 'WITH t(id) AS (VALUES (?)) SELECT t.id FROM t'; SET @val = 1; EXECUTE q USING @val;"
      docker kill mariadb-test
      

      Attachments

        Issue Links

          Activity

            People

              igor Igor Babaev
              friedrich.ue Friedrich Ueberreiter
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.