mariadb/mysql-test/r/create_drop_function.result

54 lines
2 KiB
Text

SET timestamp=UNIX_TIMESTAMP('2014-09-30 08:00:00');
CREATE FUNCTION f1(str char(20))
RETURNS CHAR(100)
RETURN CONCAT('Hello, ', str, '!');
SELECT * FROM mysql.proc WHERE name like 'f1';
db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
test f1 FUNCTION f1 SQL CONTAINS_SQL NO DEFINER str char(20) char(100) CHARSET latin1 RETURN CONCAT('Hello, ', str, '!') root@localhost 2014-09-30 08:00:00 2014-09-30 08:00:00 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION latin1 latin1_swedish_ci latin1_swedish_ci RETURN CONCAT('Hello, ', str, '!')
SELECT f1('world');
f1('world')
Hello, world!
CREATE FUNCTION f1(str char(20))
RETURNS TEXT
RETURN CONCAT('Hello2, ', str, '!');
ERROR 42000: FUNCTION f1 already exists
SELECT body FROM mysql.proc WHERE name like 'f1';
body
RETURN CONCAT('Hello, ', str, '!')
CREATE FUNCTION IF NOT EXISTS f1(str char(20))
RETURNS CHAR(100)
RETURN CONCAT('Hello3, ', str, '!');
Warnings:
Note 1304 FUNCTION f1 already exists
SELECT body FROM mysql.proc WHERE name like 'f1';
body
RETURN CONCAT('Hello, ', str, '!')
CREATE OR REPLACE FUNCTION IF NOT EXISTS f1(str char(20))
RETURNS CHAR(100)
RETURN CONCAT('Hello4, ', str, '!');
ERROR HY000: Incorrect usage of OR REPLACE and IF NOT EXISTS
SELECT body FROM mysql.proc WHERE name like 'f1';
body
RETURN CONCAT('Hello, ', str, '!')
CREATE OR REPLACE FUNCTION f1(str char(20))
RETURNS CHAR(100)
RETURN CONCAT('Hello5, ', str, '!');
SELECT body FROM mysql.proc WHERE name like 'f1';
body
RETURN CONCAT('Hello5, ', str, '!')
DROP FUNCTION f1;
CREATE FUNCTION IF NOT EXISTS f1(str char(20))
RETURNS CHAR(100)
RETURN CONCAT('Hello6, ', str, '!');
SELECT body FROM mysql.proc WHERE name like 'f1';
body
RETURN CONCAT('Hello6, ', str, '!')
SELECT f1('world');
f1('world')
Hello6, world!
DROP FUNCTION IF EXISTS f1;
SELECT body FROM mysql.proc WHERE name like 'f1';
body
DROP FUNCTION IF EXISTS f1;
Warnings:
Note 1305 FUNCTION test.f1 does not exist