[MDEV-8650] Table function: DROP FUNCTION doesn't work as expected Created: 2015-08-19  Updated: 2015-11-26  Resolved: 2015-11-26

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Procedure
Affects Version/s: N/A
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Sergei Petrunia Assignee: Sergei Petrunia
Resolution: Won't Fix Votes: 0
Labels: None

Issue Links:
PartOf
is part of MDEV-8100 Table functions (aka SQL functions re... Stalled

 Description   

This task is a part of dj '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.



 Comments   
Comment by Sergei Petrunia [ 2015-08-19 ]

dj, 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.

Generated at Thu Feb 08 07:28:45 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.