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

Stored Functions need their own temporary table namespace

    XMLWordPrintable

Details

    Description

      At present stored aggregate functions using temporary tables can only be used once within a particular query.

      Using the medi_int example from the documentation ( @ https://mariadb.com/kb/en/library/stored-aggregate-functions/ ) one can try:

       
      CREATE TABLE t1 (x int, y int);
      INSERT INTO t1 values (1,1), (2,1), (3,2);
       
      select medi_int(x) from t1;
      # works as expected
       
      select medi_int(x), medi_int(y) from t1;
      # fails due to temporary table tt already existing, it also fails in such a way that the temporary table 'tt' is left, I've not checked whether one can alter the function to catch the error and clean up the temporary table.
      
      

      Attachments

        Activity

          People

            serg Sergei Golubchik
            jakdaw Chris Wilson
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.