query simplification by @diogob
This commit is contained in:
@@ -212,15 +212,13 @@ callProc qi params selectQuery countQuery _ countTotal isSingle =
|
|||||||
SELECT
|
SELECT
|
||||||
{countResultF} AS total_result_set,
|
{countResultF} AS total_result_set,
|
||||||
pg_catalog.count(t) AS page_total,
|
pg_catalog.count(t) AS page_total,
|
||||||
case when pg_catalog.count(1) > 1
|
case
|
||||||
then {bodyF}
|
when pg_catalog.count(1) > 1 then
|
||||||
else (
|
{bodyF}
|
||||||
select case when ((array_agg(row_to_json(t)))[1]->{_procName}) is not null
|
else
|
||||||
then ((array_agg(row_to_json(t)))[1]->{_procName})::character varying
|
coalesce(((array_agg(row_to_json(t)))[1]->{_procName})::character varying, {bodyF})
|
||||||
else {bodyF}
|
|
||||||
end
|
end as body
|
||||||
)
|
|
||||||
end as body
|
|
||||||
FROM ({selectQuery}) t;
|
FROM ({selectQuery}) t;
|
||||||
|]
|
|]
|
||||||
-- FROM (select * from {sourceCTEName} {limitF range}) t;
|
-- FROM (select * from {sourceCTEName} {limitF range}) t;
|
||||||
|
|||||||
Reference in New Issue
Block a user