refactor: move schemaCacheDescription to SqlFragment

This doesn't belong in the schema cache module, as
it's unused there. It's only used on Query.hs.
This commit is contained in:
steve-chavez
2025-09-04 09:35:33 -05:00
committed by Steve Chavez
parent 96d2b69af4
commit 1ace298a1a
3 changed files with 20 additions and 13 deletions
+7
View File
@@ -40,6 +40,7 @@ module PostgREST.Query.SqlFragment
, setConfigWithConstantNameJSON
, escapeIdent
, escapeIdentList
, schemaDescription
) where
import qualified Data.Aeson as JSON
@@ -590,3 +591,9 @@ handlerF rout = \case
BuiltinOvAggCsv -> asCsvF
CustomFunc funcQi target -> customFuncF rout funcQi target
NoAgg -> "''::text"
schemaDescription :: Text -> SQL.Snippet
schemaDescription schema =
"SELECT pg_catalog.obj_description(" <> encoded <> "::regnamespace, 'pg_namespace')"
where
encoded = SQL.encoderAndParam (HE.nonNullable HE.unknown) $ encodeUtf8 schema