fix: unnecessary count() on RPC returning single
This commit is contained in:
committed by
Steve Chavez
parent
00f3cb3746
commit
54786a6c04
@@ -29,7 +29,7 @@ import PostgREST.MediaType (MTPlanFormat (..),
|
||||
MediaType (..))
|
||||
import PostgREST.Query.SqlFragment
|
||||
import PostgREST.SchemaCache.Routine (ResultAggregate (..),
|
||||
Routine)
|
||||
Routine, funcReturnsSingle)
|
||||
|
||||
import Protolude
|
||||
|
||||
@@ -121,7 +121,9 @@ prepareCall rout callProcQuery selectQuery countQuery countTotal mt rAgg =
|
||||
countCTEF <>
|
||||
"SELECT " <>
|
||||
countResultF <> " AS total_result_set, " <>
|
||||
"pg_catalog.count(_postgrest_t) AS page_total, " <>
|
||||
(if funcReturnsSingle rout
|
||||
then "1"
|
||||
else "pg_catalog.count(_postgrest_t)") <> " AS page_total, " <>
|
||||
aggF (Just rout) rAgg <> " AS body, " <>
|
||||
responseHeadersF <> " AS response_headers, " <>
|
||||
responseStatusF <> " AS response_status " <>
|
||||
|
||||
Reference in New Issue
Block a user