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

GTT: missing FUNCTION support

    XMLWordPrintable

Details

    • Can result in unexpected behaviour
    • Q4/2025 Server Development

    Description

      CREATE GLOBAL TEMPORARY TABLE gtt (c INT);
      INSERT INTO gtt VALUES (1);
       
      --delimiter //
      CREATE FUNCTION f() RETURNS INT DETERMINISTIC BEGIN
        RETURN (SELECT COUNT(*) FROM gtt);
      END//
      --delimiter ;
       
      SELECT f();
      

      Leads to:

      MDEV-35915-8 CS 12.2.0 c7ea08421d34fa7d45e27919a869ade968bd88c4 (Optimized, Clang 21.1.3-20250923) Build 20/10/2025

      CURRENT_TEST: main.test2
      mysqltest: At line 10: query 'SELECT f()' failed: ER_NO_SUCH_TABLE (1146): Table 'test.gtt' doesn't exist
      

      However, it works correctly with a temporary table:

      MDEV-35915-8 CS 12.2.0 c7ea08421d34fa7d45e27919a869ade968bd88c4 (Optimized, Clang 21.1.3-20250923) Build 20/10/2025

      SELECT f();
      f()
      1
      main.test2                               [ pass ]     
      

      Attachments

        Issue Links

          Activity

            People

              nikitamalyavin Nikita Malyavin
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.