summaryrefslogtreecommitdiff
path: root/mysql-test/t/create_drop_udf.test
blob: 5908bf04e9079a02682e6459887dfd42b9647e3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
--source include/have_udf.inc

--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
eval CREATE FUNCTION IF NOT EXISTS metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_SO";
SELECT ret FROM mysql.func WHERE name like 'metaphon';

--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
--error ER_UDF_EXISTS
CREATE FUNCTION metaphon RETURNS INT SONAME "$UDF_EXAMPLE_SO";
SELECT ret FROM mysql.func WHERE name like 'metaphon';

--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
eval CREATE FUNCTION IF NOT EXISTS metaphon RETURNS REAL SONAME "$UDF_EXAMPLE_SO";
SELECT ret FROM mysql.func WHERE name like 'metaphon';

DROP FUNCTION IF EXISTS metaphon;
--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
eval CREATE FUNCTION IF NOT EXISTS metaphon RETURNS REAL SONAME "$UDF_EXAMPLE_SO";
SELECT ret FROM mysql.func WHERE name like 'metaphon';

--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
--error ER_WRONG_USAGE
eval CREATE OR REPLACE FUNCTION IF NOT EXISTS metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_SO";
SELECT ret FROM mysql.func WHERE name like 'metaphon';

--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
eval CREATE OR REPLACE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_SO";
SELECT ret FROM mysql.func WHERE name like 'metaphon';

--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
--error ER_UDF_EXISTS
eval CREATE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_SO";
SELECT metaphon('mariadb');

DROP FUNCTION metaphon;
DROP FUNCTION IF EXISTS metaphon;