From 8cc118e5426f8d9f63464f1d36a026eb9d7ae479 Mon Sep 17 00:00:00 2001 From: Marcel Schwarz Date: Fri, 14 Jun 2024 15:20:38 +0200 Subject: [PATCH] Cast count to string as the value of `$count` has a type of `Int64` --- db-service/lib/SQLService.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db-service/lib/SQLService.js b/db-service/lib/SQLService.js index 8a19be1ef..9fc42f80a 100644 --- a/db-service/lib/SQLService.js +++ b/db-service/lib/SQLService.js @@ -287,7 +287,7 @@ class SQLService extends DatabaseService { const { one, limit: _ } = query.SELECT, n = ret.length const [max, offset = 0] = one ? [1] : _ ? [_.rows?.val, _.offset?.val] : [] - if (max === undefined || (n < max && (n || !offset))) return n + offset + if (max === undefined || (n < max && (n || !offset))) return String(n + offset) } // Keep original query columns when potentially used insde conditions @@ -295,7 +295,7 @@ class SQLService extends DatabaseService { const columns = (having?.length || groupBy?.length) ? query.SELECT.columns.filter(c => !c.expand) : [{ val: 1 }] - const cq = SELECT.one([{ func: 'count' }]).from( + const cq = SELECT.one([{ func: 'count', cast: 'cds.Integer64' }]).from( cds.ql.clone(query, { columns, localized: false,