Skip to content

Commit 427680a

Browse files
committed
fix(sftkit): use pg_roles instead of pg_authid for function filtering
Apparently db superuser permissions are needed for pg_authid, but every user can read pg_roles. The information we need is available in both.
1 parent 5ca648d commit 427680a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sftkit/src/sftkit/database/introspection/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ async def list_functions(conn: Connection, schema: str) -> list[PgFunctionDef]:
4343
return await conn.fetch_many(
4444
PgFunctionDef,
4545
"select p.*, pg_get_function_identity_arguments(p.oid) as signature from pg_proc as p "
46-
"join pg_authid as a on p.proowner = a.oid "
46+
"join pg_roles as a on p.proowner = a.oid "
4747
"where p.pronamespace = $1::regnamespace and a.rolname = CURRENT_USER "
4848
" and not exists(select from pg_depend as d where d.objid = p.oid and d.deptype = 'e')",
4949
schema,

0 commit comments

Comments
 (0)