Debian Codegraph @

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

raw
1 INSTALL COMPONENT "file://component_udf_reg_only_3_func";
2 INSTALL COMPONENT "file://component_udf_reg_int_func";
3 ERROR HY000: Initialization method provided by component 'mysql:test_udf_registration' failed.
4 SELECT * FROM performance_schema.user_defined_functions
5 WHERE (udf_name LIKE 'myfunc%') or (udf_name LIKE 'avgcost%')
6 ORDER BY udf_name;
7 UDF_NAME UDF_RETURN_TYPE UDF_TYPE UDF_LIBRARY UDF_USAGE_COUNT
8 avgcost double aggregate NULL 1
9 myfunc_double double function NULL 1
10 myfunc_int integer function NULL 1
11 select myfunc_double();
12 ERROR HY000: Can't initialize function 'myfunc_double'; myfunc_double must have at least one argument
13 select myfunc_double(1);
14 myfunc_double(1)
15 49.00
16 select myfunc_double(78654);
17 myfunc_double(78654)
18 54.00
19 select myfunc_int();
20 myfunc_int()
21 0
22 select myfunc_int(5);
23 myfunc_int(5)
24 5
25 select myfunc_int('MySQL V8.0');
26 myfunc_int('MySQL V8.0')
27 10
28 SELECT udf_name,udf_usage_count FROM performance_schema.user_defined_functions
29 WHERE udf_name= 'myfunc_int'
30 ORDER BY udf_name;
31 udf_name udf_usage_count
32 myfunc_int 1
33 CREATE TABLE t1(a INT, b INT);
34 INSERT INTO t1 values (1,1),(2,2);
35 SELECT myfunc_int(a AS attr_name) FROM t1;
36 myfunc_int(a AS attr_name)
37 1
38 2
39 drop table t1;
40 create table t1(sum int, price float(24));
41 insert into t1 values(100, 50.00), (100, 100.00);
42 select avgcost(price) from t1;
43 ERROR HY000: Can't initialize function 'avgcost'; wrong number of arguments: AVGCOST() requires two arguments
44 select avgcost(sum, price) from t1;
45 avgcost(sum, price)
46 75.0000
47 delete from t1;
48 insert into t1 values(100, 54.33), (200, 199.99);
49 select avgcost(sum, price) from t1;
50 avgcost(sum, price)
51 151.4367
52 drop table t1;
53 # remove the plugin
54 INSTALL COMPONENT "file://component_udf_unreg_3_func";
55 select myfunc_double(1);
56 ERROR 42000: FUNCTION test.myfunc_double does not exist
57 select myfunc_int(5);
58 ERROR 42000: FUNCTION test.myfunc_int does not exist
59 INSTALL COMPONENT "file://component_udf_reg_int_func";
60 SELECT * FROM performance_schema.user_defined_functions
61 WHERE (udf_name LIKE 'myfunc%') or (udf_name LIKE 'avgcost%')
62 ORDER BY udf_name;
63 UDF_NAME UDF_RETURN_TYPE UDF_TYPE UDF_LIBRARY UDF_USAGE_COUNT
64 myfunc_int integer function NULL 1
65 SELECT * FROM mysql.func;
66 name ret dl type
67 SELECT component_urn FROM mysql.component;
68 component_urn
69 file://component_udf_reg_only_3_func
70 file://component_udf_unreg_3_func
71 file://component_udf_reg_int_func
72 select myfunc_double(1);
73 ERROR 42000: FUNCTION test.myfunc_double does not exist
74 select myfunc_int(5);
75 myfunc_int(5)
76 5
77 INSTALL COMPONENT "file://component_udf_reg_real_func";
78 SELECT * FROM performance_schema.user_defined_functions
79 WHERE (udf_name LIKE 'myfunc%') or (udf_name LIKE 'avgcost%')
80 ORDER BY udf_name;
81 UDF_NAME UDF_RETURN_TYPE UDF_TYPE UDF_LIBRARY UDF_USAGE_COUNT
82 myfunc_double double function NULL 1
83 myfunc_int integer function NULL 1
84 SELECT * FROM mysql.func;
85 name ret dl type
86 select myfunc_double(1);
87 myfunc_double(1)
88 49.00
89 select myfunc_int(5);
90 myfunc_int(5)
91 5
92 UNINSTALL COMPONENT "file://component_udf_reg_real_func";
93 SELECT * FROM performance_schema.user_defined_functions
94 WHERE (udf_name LIKE 'myfunc%') or (udf_name LIKE 'avgcost%')
95 ORDER BY udf_name;
96 UDF_NAME UDF_RETURN_TYPE UDF_TYPE UDF_LIBRARY UDF_USAGE_COUNT
97 myfunc_int integer function NULL 1
98 SELECT component_urn FROM mysql.component;
99 component_urn
100 file://component_udf_reg_only_3_func
101 file://component_udf_unreg_3_func
102 file://component_udf_reg_int_func
103 UNINSTALL COMPONENT "file://component_udf_reg_only_3_func";
104 SELECT * FROM performance_schema.user_defined_functions
105 WHERE (udf_name LIKE 'myfunc%') or (udf_name LIKE 'avgcost%')
106 ORDER BY udf_name;
107 UDF_NAME UDF_RETURN_TYPE UDF_TYPE UDF_LIBRARY UDF_USAGE_COUNT
108 myfunc_int integer function NULL 1
109 SELECT component_urn FROM mysql.component;
110 component_urn
111 file://component_udf_unreg_3_func
112 file://component_udf_reg_int_func
113 UNINSTALL COMPONENT "file://component_udf_unreg_3_func";
114 SELECT * FROM performance_schema.user_defined_functions
115 WHERE (udf_name LIKE 'myfunc%') or (udf_name LIKE 'avgcost%')
116 ORDER BY udf_name;
117 UDF_NAME UDF_RETURN_TYPE UDF_TYPE UDF_LIBRARY UDF_USAGE_COUNT
118 myfunc_int integer function NULL 1
119 SELECT component_urn FROM mysql.component;
120 component_urn
121 file://component_udf_reg_int_func
122 UNINSTALL COMPONENT "file://component_udf_reg_int_func";
123 SELECT * FROM performance_schema.user_defined_functions
124 WHERE (udf_name LIKE 'myfunc%') or (udf_name LIKE 'avgcost%')
125 ORDER BY udf_name;
126 UDF_NAME UDF_RETURN_TYPE UDF_TYPE UDF_LIBRARY UDF_USAGE_COUNT
127 SELECT component_urn FROM mysql.component;
128 component_urn