refactor: move accessibleFuncs to SqlFragment

This commit is contained in:
steve-chavez
2025-09-04 09:35:33 -05:00
committed by Steve Chavez
parent 9c07070263
commit 1dca23e7af
3 changed files with 95 additions and 14 deletions
+1 -9
View File
@@ -21,8 +21,8 @@ These queries are executed once at startup or when PostgREST is reloaded.
module PostgREST.SchemaCache
( SchemaCache(..)
, querySchemaCache
, accessibleFuncs
, showSummary
, decodeFuncs
) where
import Control.Monad.Extra (whenJust)
@@ -357,14 +357,6 @@ allFunctions = SQL.Statement funcsSqlQuery params decodeFuncs
(map escapeIdent . toList . configDbSchemas >$< arrayParam HE.text) <>
(configDbHoistedTxSettings >$< arrayParam HE.text)
accessibleFuncs :: Bool -> SQL.Statement ([Schema], [Text]) RoutineMap
accessibleFuncs = SQL.Statement sql params decodeFuncs
where
params =
(fst >$< arrayParam HE.text) <>
(snd >$< arrayParam HE.text)
sql = funcsSqlQuery <> " AND has_function_privilege(p.oid, 'execute')"
baseTypesCte :: Text
baseTypesCte = [trimming|
-- Recursively get the base types of domains