Allow returning XML from RPCs

This commit is contained in:
Franz-Josef Färber
2022-04-26 17:37:59 -05:00
committed by Steve Chavez
parent a8477b7822
commit d2aa50be52
9 changed files with 66 additions and 5 deletions
+4
View File
@@ -13,6 +13,7 @@ module PostgREST.Query.SqlFragment
, asCsvF
, asJsonF
, asJsonSingleF
, asXmlF
, countF
, fromQi
, limitOffsetF
@@ -176,6 +177,9 @@ asJsonSingleF returnsScalar
| returnsScalar = "coalesce((json_agg(_postgrest_t.pgrst_scalar)->0)::text, 'null')"
| otherwise = "coalesce((json_agg(_postgrest_t)->0)::text, 'null')"
asXmlF :: FieldName -> SqlFragment
asXmlF fieldName = "coalesce(xmlagg(_postgrest_t." <> pgFmtIdent fieldName <> "), '')"
asBinaryF :: FieldName -> SqlFragment
asBinaryF fieldName = "coalesce(string_agg(_postgrest_t." <> pgFmtIdent fieldName <> ", ''), '')"