I've wrote few psql functions and for some reason ...
# sql
d
I've wrote few psql functions and for some reason sql queries were disappeared from sql editors. How to find source code of those functions in supabase?
I've tried \dq+ it throws an error
Copy code
syntax error at or near "\"
b
Copy code
select n.nspname as function_schema,
    p.proname as function_name,
    l.lanname as function_language,
    case when l.lanname = 'internal' then p.prosrc
         else pg_get_functiondef(p.oid)
         end as definition,
    pg_get_function_arguments(p.oid) as function_arguments,
    t.typname as return_type, p.prosecdef as security_definer
     from pg_proc p
     left join pg_namespace n on p.pronamespace = n.oid
     left join pg_language l on p.prolang = l.oid
     left join pg_type t on t.oid = p.prorettype 
     where n.nspname = 'public'
     and p.proname = 'my_function_name';
Just put in your schema and function name at the bottom.
The "definition" field will have your source code.
d
that was a quite big query and I wasn't expecting that 🙂 thank you it worked 🙏
b
👍 It probably didn't need to be that big but when I was using this I need a lot of info about all my functions.