How to extract the ddl of a function in Redshift database

You can query the pg_proc system catalog table to view the definition of a user defined function(UDF) in Redshift database as shown below:

SELECT prosrc from pg_proc where proname like '%your_function_name%';

See also  How to get the first character of a string in Redshift database