Debian Codegraph @

mysql-test/suite/service_udf_registration/r/udf_reg_unreg_3_func.result

raw
1 INSTALL COMPONENT "file://component_udf_reg_only_3_func";
2 SELECT * FROM performance_schema.user_defined_functions
3 WHERE (udf_name LIKE 'myfunc%') or (udf_name LIKE 'avgcost%')
4 ORDER BY udf_name;
5 UDF_NAME UDF_RETURN_TYPE UDF_TYPE UDF_LIBRARY UDF_USAGE_COUNT
6 avgcost double aggregate NULL 1
7 myfunc_double double function NULL 1
8 myfunc_int integer function NULL 1
9 select myfunc_double();
10 ERROR HY000: Can't initialize function 'myfunc_double'; myfunc_double must have at least one argument
11 select myfunc_double(1);
12 myfunc_double(1)
13 49.00
14 select myfunc_double(78654);
15 myfunc_double(78654)
16 54.00
17 select myfunc_int();
18 myfunc_int()
19 0
20 select myfunc_int(5);
21 myfunc_int(5)
22 5
23 select myfunc_int('MySQL V8.0');
24 myfunc_int('MySQL V8.0')
25 10
26 CREATE TABLE t1(a INT, b INT);
27 INSERT INTO t1 values (1,1),(2,2);
28 SELECT myfunc_int(a AS attr_name) FROM t1;
29 myfunc_int(a AS attr_name)
30 1
31 2
32 drop table t1;
33 create table t1(sum int, price float(24));
34 insert into t1 values(100, 50.00), (100, 100.00);
35 select avgcost(sum, price) from t1;
36 avgcost(sum, price)
37 75.0000
38 delete from t1;
39 insert into t1 values(100, 54.33), (200, 199.99);
40 select avgcost(sum, price) from t1;
41 avgcost(sum, price)
42 151.4367
43 drop table t1;
44 # remove the plugin
45 INSTALL COMPONENT "file://component_udf_unreg_3_func";
46 select myfunc_double(1);
47 ERROR 42000: FUNCTION test.myfunc_double does not exist
48 select myfunc_int(5);
49 ERROR 42000: FUNCTION test.myfunc_int does not exist
50 UNINSTALL COMPONENT "file://component_udf_reg_only_3_func";
51 UNINSTALL COMPONENT "file://component_udf_unreg_3_func";