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

Failure at second executon of PS for query using stored function

Details

    Description

      The following test case fails if the server is built with -DWITH_PROTECT_STATEMENT_MEMROOT:BOOL=ON

      CREATE TABLE t1 (a INT,b INT);
      INSERT INTO t1 VALUES (10,1),(20,2),(30,3),(40,4);
      CREATE VIEW v1 AS
      SELECT a,1 as b FROM t1 WHERE a>(SELECT AVG(a) FROM t1 t) AND b>(SELECT 1);
      DELIMITER |;
      CREATE FUNCTION f1() RETURNS INT
      BEGIN
        DECLARE a TYPE OF v1.a DEFAULT 10;
        RETURN a+1;
      END;
      |
      DELIMITER ;|
      PREPARE stmt FROM "SELECT f1();";
      EXECUTE stmt;
      EXECUTE stmt;
      DEALLOCATE PREPARE stmt;
      DROP FUNCTION f1;
      DROP VIEW v1;
      DROP TABLE t1;
      

      Attachments

        Issue Links

          Activity

            igor Igor Babaev added a comment -

            Some observations:
            The list of global tables for the SF f1 is empty.
            TABLE_LIST structures for v1, t1,t are allocated at each execution of PS. So it's a memory leak.

            igor Igor Babaev added a comment - Some observations: The list of global tables for the SF f1 is empty. TABLE_LIST structures for v1, t1,t are allocated at each execution of PS. So it's a memory leak.
            shulga Dmitry Shulga added a comment -

            This bug report is duplicate of the task https://jira.mariadb.org/browse/MDEV-32466

            shulga Dmitry Shulga added a comment - This bug report is duplicate of the task https://jira.mariadb.org/browse/MDEV-32466
            ycp Yuchen Pei added a comment -

            > This bug report is duplicate of the task https://jira.mariadb.org/browse/MDEV-32466

            Does this mean MDEV-32466 blocks MDEV-30073?

            ycp Yuchen Pei added a comment - > This bug report is duplicate of the task https://jira.mariadb.org/browse/MDEV-32466 Does this mean MDEV-32466 blocks MDEV-30073 ?
            shulga Dmitry Shulga added a comment -

            Yes, that is.

            shulga Dmitry Shulga added a comment - Yes, that is.

            People

              shulga Dmitry Shulga
              igor Igor Babaev
              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.