File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
sftkit/src/sftkit/database/introspection Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -37,10 +37,15 @@ class PgFunctionDef(BaseModel):
3737
3838
3939async def list_functions (conn : Connection , schema : str ) -> list [PgFunctionDef ]:
40+ """
41+ List all functions which are owned by the current database user and do not belong to any extension.
42+ """
4043 return await conn .fetch_many (
4144 PgFunctionDef ,
42- "select pg_proc.*, pg_get_function_identity_arguments(oid) as signature from pg_proc "
43- "where pronamespace = $1::regnamespace and pg_proc.proname !~ '^pg_';" ,
45+ "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 "
47+ "where p.pronamespace = $1::regnamespace and a.rolname = CURRENT_USER "
48+ " and not exists(select from pg_depend as d where d.objid = p.oid and d.deptype = 'e')" ,
4449 schema ,
4550 )
4651
You can’t perform that action at this time.
0 commit comments