04/12/2022 12:27 | Category: redshift

Tags: dbadatabasesredshiftawsstored_procedure

listing stored procedures from redshift

Finding if a stored procedure is in the proper schema is sometimes important for troubleshooting what something was created against. This is true for all database engines (Postgres, MSSQL, RedShift, etc.) and is important to be comfortable checking in on.

I've found that the stored procedures will sometimes be created in a public schema or a pg_catalog specific schema.

To check, I utilize this query from StackOverflow:

SELECT
    n.nspname AS function_schema,
    p.proname AS function_name
FROM
    pg_proc p
LEFT JOIN pg_namespace n ON p.pronamespace = n.oid
WHERE
    n.nspname NOT IN ('pg_catalog', 'information_schema')
    AND
    p.proname ILIKE '%your-procedure-name%'
ORDER BY
    function_schema,
    function_name;