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

Table function: DROP FUNCTION doesn't work as expected

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: N/A
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      This task is a part of diwas joshi 's GSoC project.

      Consider this testcase:
      First, let's create a table function:

      MariaDB [test]> delimiter |
      MariaDB [test]> CREATE FUNCTION f21(param1 VARCHAR(11))
          -> RETURNS TABLE return_table(name VARCHAR(11)) 
          -> deterministic
          -> BEGIN
          -> insert into return_table values('foo');
          -> END|
      Query OK, 0 rows affected (0.01 sec)
      MariaDB [test]> DELIMITER ;
      

      Then use it:

      MariaDB [test]> select name from f21('aaa');
      +------+
      | name |
      +------+
      | foo  |
      +------+
      1 row in set (0.45 sec)
      

      Then drop it:

      MariaDB [test]> drop function f21;
      Query OK, 0 rows affected (0.04 sec)
      

      And then try using it again:

      MariaDB [test]> select name from f21('aaa');
      +------+
      | name |
      +------+
      | foo  |
      +------+
      1 row in set (0.26 sec)
      

      Oops. Why is the function still here?

      Btw, if I restart the server, I get:

      MariaDB [test]> select name from f21('aaa');
      ERROR 1146 (42S02): Table 'test.f21' doesn't exist
      

      Apparently the stored function is sitting in some in-memory cache.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              psergey Sergei Petrunia added a comment -

              diwas joshi, this can be debugged as follows: start two debuggers and debug two instances of mariadb. In one debugger, create/use/drop a regular stored function, in the other one - create/use/drop a table function.

              Debug what happens inside DROP FUNCTION in both cases and figure out where the difference comes from.

              Show
              psergey Sergei Petrunia added a comment - diwas joshi , this can be debugged as follows: start two debuggers and debug two instances of mariadb. In one debugger, create/use/drop a regular stored function, in the other one - create/use/drop a table function. Debug what happens inside DROP FUNCTION in both cases and figure out where the difference comes from.

                People

                • Assignee:
                  psergey Sergei Petrunia
                  Reporter:
                  psergey Sergei Petrunia
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  1 Start watching this issue

                  Dates

                  • Created:
                    Updated: