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

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

Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.11.6, 10.11.7, 10.11.8, 10.11.9, 10.11.10, 10.6, 10.11, 11.4, 11.7(EOL)
    • 10.5, 10.6, 10.11, 11.4
    • docker (official mariadb docker image)

    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

            alice Alice Sherepa added a comment -

            Thanks! I repeated as described.
            The regression after ab9b1461a0

            MDEV-32225 Test case from opt_tvc.test fails with statement memory protection
             
            Memory for type holders of the columns of a table value constructor must
            be allocated only once.
            

            alice Alice Sherepa added a comment - Thanks! I repeated as described. The regression after ab9b1461a0 MDEV-32225 Test case from opt_tvc.test fails with statement memory protection   Memory for type holders of the columns of a table value constructor must be allocated only once.

            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.