@@ -20,8 +20,7 @@ import PostgREST.Plan.MutatePlan as MTPlan
2020import PostgREST.Plan.ReadPlan
2121import PostgREST.Query.QueryBuilder
2222import PostgREST.Query.SqlFragment
23- import PostgREST.SchemaCache.Routine (MediaHandler (.. ), Routine ,
24- funcReturnsSingle )
23+ import PostgREST.SchemaCache.Routine (MediaHandler (.. ), Routine )
2524
2625import Protolude
2726
@@ -72,7 +71,7 @@ mainRead rPlan countQuery pCount maxRows mt handler = mtSnippet mt snippet
7271 countCTEF <> " " <>
7372 " SELECT " <>
7473 countResultF <> " AS total_result_set, " <>
75- " pg_catalog.count(_postgrest_t) AS page_total, " <>
74+ pageCountSelectF Nothing <> " AS page_total, " <>
7675 handlerF Nothing handler <> " AS body, " <>
7776 responseHeadersF <> " AS response_headers, " <>
7877 responseStatusF <> " AS response_status, " <>
@@ -97,9 +96,7 @@ mainCall rout cPlan rPlan pCount mt handler = mtSnippet mt snippet
9796 countCTEF <>
9897 " SELECT " <>
9998 countResultF <> " AS total_result_set, " <>
100- (if funcReturnsSingle rout
101- then " 1"
102- else " pg_catalog.count(_postgrest_t)" ) <> " AS page_total, " <>
99+ pageCountSelectF (Just rout) <> " AS page_total, " <>
103100 handlerF (Just rout) handler <> " AS body, " <>
104101 responseHeadersF <> " AS response_headers, " <>
105102 responseStatusF <> " AS response_status, " <>
0 commit comments