5

How do I display all the UDFs (User Definied Functions) on a MySQL server? (version 5.0.x)

UPDATE I don't want to display the code of all the UDFs, I just want to list the name of each UDF that is installed. Sorta like SHOW DATABASES, but for UDFs.

Amandasaurus
  • 31,471
  • 65
  • 192
  • 253

4 Answers4

12

UDF are stored in FUNC table of mysql DB.

Try this:

 select * from mysql.func;
splattne
  • 28,508
  • 20
  • 98
  • 148
nick
  • 121
  • 1
  • 3
2

All procedures are stored in the mysql db. I usually use this query when I'm looking for something.

select db,name,definer,modified from mysql.proc;

kashani
  • 3,922
  • 19
  • 18
1

According to the docs it looks like you can't do this without debugging enabled in the build.

See: (This page is for functions as well as procs)

http://dev.mysql.com/doc/refman/5.0/en/show-procedure-code.html

LapTop006
  • 6,496
  • 20
  • 26
0

If you want to build statements (say for restoring from a backup, or creating the same UDFs on another system) you can use this

select concat('create function`',`name`,'`returns ',if(`ret`=0,'string','integer'),' soname\'',`dl`,'\';')from mysql.func;

Should return something like

create function`preg_position`returns integer soname'lib_mysqludf_preg.so';
create function`preg_rlike`returns integer soname'lib_mysqludf_preg.so';
create function`preg_replace`returns string soname'lib_mysqludf_preg.so';
create function`lib_mysqludf_preg_info`returns string soname'lib_mysqludf_preg.so';
create function`preg_capture`returns string soname'lib_mysqludf_preg.so';
create function`preg_check`returns integer soname'lib_mysqludf_preg.so';
create function`unhtml`returns string soname'unhtml.so';
Brian Leishman
  • 111
  • 1
  • 8