How to list all the stored procedure in AWS RedShift
Asked Answered
H

2

16

I was checking this, but not find the proper one. So I prepared one and sharing that query here.

Haemal answered 8/6, 2020 at 8:22 Comment(1)
H
26
SELECT
    n.nspname,
    b.usename,
    p.proname,
    p.prosrc
FROM
    pg_catalog.pg_namespace n
JOIN pg_catalog.pg_proc p ON
    pronamespace = n.oid
join pg_user b on
    b.usesysid = p.proowner
where
    nspname not in ('information_schema',
    'pg_catalog')
Haemal answered 8/6, 2020 at 8:23 Comment(1)
There is a very small mistake, missed out the schema name for pg_user. ``` SELECT n.nspname, b.usename, p.proname, p.prosrc FROM pg_catalog.pg_namespace n JOIN pg_catalog.pg_proc p ON pronamespace = n.oid join pg_catalog.pg_user b on b.usesysid = p.proowner where nspname not in ('information_schema', 'pg_catalog') ```Onomastics
O
2

This was really helpful. There is a very small mistake, missed out the schema name for pg_user.

SELECT
    n.nspname,
    b.usename,
    p.proname,
    p.prosrc
FROM
    pg_catalog.pg_namespace n
JOIN pg_catalog.pg_proc p ON
    pronamespace = n.oid
join pg_catalog.pg_user b on
    b.usesysid = p.proowner
where
    nspname not in ('information_schema',
    'pg_catalog')
Onomastics answered 13/1, 2022 at 12:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.