PostgreSQL: Extract function DDL

PHOTO EMBED

Mon Aug 29 2022 15:46:27 GMT+0000 (Coordinated Universal Time)

Saved by @marcopinero #sql

SELECT n.nspname AS schema_name
      ,p.proname AS function_name
      ,pg_get_functiondef(p.oid) AS func_def
      ,pg_get_function_arguments(p.oid) AS args
      ,pg_get_function_result(p.oid) AS result
FROM   pg_proc p
JOIN   pg_namespace n ON n.oid = p.pronamespace
WHERE  p.proname ILIKE 'func_name%';
content_copyCOPY

Extract function DDL in Postgres.