diff --git a/mysql-test/r/create_drop_udf.result b/mysql-test/r/create_drop_udf.result index 1024be9e30b..40da0b62a3a 100644 --- a/mysql-test/r/create_drop_udf.result +++ b/mysql-test/r/create_drop_udf.result @@ -18,7 +18,7 @@ CREATE FUNCTION IF NOT EXISTS metaphon RETURNS REAL SONAME "UDF_EXAMPLE_LIB"; SELECT ret FROM mysql.func WHERE name like 'metaphon'; ret 1 -CREATE OR REPLACE FUNCTION IF NOT EXISTS metaphon RETURNS STRING SONAME "udf_example.so"; +CREATE OR REPLACE FUNCTION IF NOT EXISTS metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB"; ERROR HY000: Incorrect usage of OR REPLACE and IF NOT EXISTS SELECT ret FROM mysql.func WHERE name like 'metaphon'; ret @@ -27,7 +27,7 @@ CREATE OR REPLACE FUNCTION metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB"; SELECT ret FROM mysql.func WHERE name like 'metaphon'; ret 0 -CREATE FUNCTION metaphon RETURNS STRING SONAME "udf_example.so"; +CREATE FUNCTION metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB"; ERROR HY000: Function 'metaphon' already exists SELECT metaphon('mariadb'); metaphon('mariadb') diff --git a/mysql-test/r/create_or_replace_permission.result b/mysql-test/r/create_or_replace_permission.result index b94f2443d77..dc40d39bbfe 100644 --- a/mysql-test/r/create_or_replace_permission.result +++ b/mysql-test/r/create_or_replace_permission.result @@ -31,7 +31,7 @@ CREATE OR REPLACE TABLE t1(id INT); ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table 't1' CREATE OR REPLACE PROCEDURE proc1 (OUT cnt INT) BEGIN END; ERROR 42000: alter routine command denied to user 'mysqltest_1'@'localhost' for routine 'db1.proc1' -CREATE OR REPLACE FUNCTION lookup RETURNS STRING SONAME "udf_example.so"; +CREATE OR REPLACE FUNCTION lookup RETURNS STRING SONAME "UDF_EXAMPLE_LIB"; ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysql' CREATE OR REPLACE FUNCTION hello(str char(20)) RETURNS TEXT RETURN CONCAT('Hello, ', str, '!'); ERROR 42000: alter routine command denied to user 'mysqltest_1'@'localhost' for routine 'db1.hello' diff --git a/mysql-test/suite/rpl/r/rpl_create_drop_udf.result b/mysql-test/suite/rpl/r/rpl_create_drop_udf.result index 6c6b766d66d..c7089c0ec5b 100644 --- a/mysql-test/suite/rpl/r/rpl_create_drop_udf.result +++ b/mysql-test/suite/rpl/r/rpl_create_drop_udf.result @@ -4,28 +4,28 @@ CREATE FUNCTION metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB"; SELECT metaphon('master'); metaphon('master') MSTR -CREATE FUNCTION metaphon RETURNS INT SONAME "udf_example.so"; +CREATE FUNCTION metaphon RETURNS INT SONAME "UDF_EXAMPLE_LIB"; ERROR HY000: Function 'metaphon' already exists SELECT metaphon('slave'); metaphon('slave') SLF -CREATE FUNCTION IF NOT EXISTS metaphon RETURNS STRING SONAME "udf_example.so"; +CREATE FUNCTION IF NOT EXISTS metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB"; Warnings: Note 1125 Function 'metaphon' already exists DROP FUNCTION IF EXISTS random_function_name; Warnings: Note 1305 FUNCTION test.random_function_name does not exist -CREATE FUNCTION IF NOT EXISTS metaphon RETURNS STRING SONAME "udf_example.so"; +CREATE FUNCTION IF NOT EXISTS metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB"; Warnings: Note 1125 Function 'metaphon' already exists -CREATE OR REPLACE FUNCTION IF NOT EXISTS metaphon RETURNS STRING SONAME "udf_example.so"; +CREATE OR REPLACE FUNCTION IF NOT EXISTS metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB"; ERROR HY000: Incorrect usage of OR REPLACE and IF NOT EXISTS SELECT metaphon('slave'); metaphon('slave') SLF DROP FUNCTION metaphon; -CREATE OR REPLACE FUNCTION metaphon RETURNS STRING SONAME "udf_example.so"; -CREATE FUNCTION metaphon RETURNS STRING SONAME "udf_example.so"; +CREATE OR REPLACE FUNCTION metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB"; +CREATE FUNCTION metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB"; ERROR HY000: Function 'metaphon' already exists SELECT metaphon('slave'); metaphon('slave') diff --git a/mysql-test/suite/rpl/t/rpl_create_drop_udf.test b/mysql-test/suite/rpl/t/rpl_create_drop_udf.test index ace2fa0ef1a..af24cabd338 100644 --- a/mysql-test/suite/rpl/t/rpl_create_drop_udf.test +++ b/mysql-test/suite/rpl/t/rpl_create_drop_udf.test @@ -1,11 +1,13 @@ +--source include/have_udf.inc --source include/master-slave.inc ---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB connection master; +--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB eval CREATE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_SO"; SELECT metaphon('master'); +--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB --error ER_UDF_EXISTS eval CREATE FUNCTION metaphon RETURNS INT SONAME "$UDF_EXAMPLE_SO"; @@ -15,10 +17,13 @@ SELECT metaphon('slave'); connection master; +--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB eval CREATE FUNCTION IF NOT EXISTS metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_SO"; DROP FUNCTION IF EXISTS random_function_name; +--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB eval CREATE FUNCTION IF NOT EXISTS metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_SO"; +--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"; sync_slave_with_master; @@ -28,8 +33,10 @@ SELECT metaphon('slave'); connection master; DROP FUNCTION metaphon; +--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB eval CREATE OR REPLACE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_SO"; +--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB --error ER_UDF_EXISTS eval CREATE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_SO"; sync_slave_with_master; diff --git a/mysql-test/t/create_drop_binlog.test b/mysql-test/t/create_drop_binlog.test index 357cf8893fc..655a54308d6 100644 --- a/mysql-test/t/create_drop_binlog.test +++ b/mysql-test/t/create_drop_binlog.test @@ -1,3 +1,4 @@ +--source include/have_udf.inc --source include/have_log_bin.inc --let $binlog_file=query_get_value(SHOW MASTER STATUS, File, 1) diff --git a/mysql-test/t/create_drop_udf.test b/mysql-test/t/create_drop_udf.test index cc1b0a2c51e..5908bf04e90 100644 --- a/mysql-test/t/create_drop_udf.test +++ b/mysql-test/t/create_drop_udf.test @@ -1,11 +1,15 @@ +--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'; @@ -15,6 +19,7 @@ DROP FUNCTION IF EXISTS metaphon; 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'; @@ -23,6 +28,7 @@ SELECT ret FROM mysql.func WHERE name like 'metaphon'; 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'); diff --git a/mysql-test/t/create_or_replace_permission.test b/mysql-test/t/create_or_replace_permission.test index 32a721e9d68..22ba40f43f9 100644 --- a/mysql-test/t/create_or_replace_permission.test +++ b/mysql-test/t/create_or_replace_permission.test @@ -1,3 +1,4 @@ +--source include/have_udf.inc # Grant tests not performed with embedded server -- source include/not_embedded.inc @@ -44,8 +45,9 @@ CREATE OR REPLACE TABLE t1(id INT); --error ER_PROCACCESS_DENIED_ERROR CREATE OR REPLACE PROCEDURE proc1 (OUT cnt INT) BEGIN END; +--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB --error ER_DBACCESS_DENIED_ERROR -CREATE OR REPLACE FUNCTION lookup RETURNS STRING SONAME "udf_example.so"; +eval CREATE OR REPLACE FUNCTION lookup RETURNS STRING SONAME "$UDF_EXAMPLE_SO"; --error ER_PROCACCESS_DENIED_ERROR CREATE OR REPLACE FUNCTION hello(str char(20)) RETURNS TEXT RETURN CONCAT('Hello, ', str, '!');