diff --git a/postgres/lib/PostgresService.js b/postgres/lib/PostgresService.js index 916af2877..7bb7d999f 100644 --- a/postgres/lib/PostgresService.js +++ b/postgres/lib/PostgresService.js @@ -578,9 +578,12 @@ GROUP BY k Association: e => `jsonb(${e})`, struct: e => `jsonb(${e})`, array: e => `jsonb(${e})`, + // REVISIT: Didn't our recent analyses show that PostgreSQL drivers are doing that already by default? + // So, why do we have to do anything here at all? // Reading int64 as string to not loose precision Int64: cds.env.features.ieee754compatible ? expr => `cast(${expr} as varchar)` : undefined, - // REVISIT: always cast to string in next major + // REVISIT: Didn't our recent analyses show that PostgreSQL drivers are doing that already by default? + // So, why do we have to do anything here at all? // Reading decimal as string to not loose precision Decimal: cds.env.features.ieee754compatible ? (expr, elem) => elem?.scale ? `to_char(${expr},'FM${'0'.padStart(elem.precision, '9')}${'D'.padEnd(elem.scale + 1, '0')}')` diff --git a/sqlite/lib/SQLiteService.js b/sqlite/lib/SQLiteService.js index bf5447ce8..ccd4e4b19 100644 --- a/sqlite/lib/SQLiteService.js +++ b/sqlite/lib/SQLiteService.js @@ -275,7 +275,7 @@ class SQLiteService extends SQLService { ? (expr, elem) => elem?.scale ? `CASE WHEN ${expr} IS NULL THEN NULL ELSE format('%.${elem.scale}f', ${expr}) END` - : `CASE WHEN ${expr} IS NULL THEN NULL ELSE rtrim(rtrim(format('%.999f', ${expr}), '0'), '.') END` + : `CAST(${expr} as TEXT)` // or: `(''||${expr})` : undefined, // Binary is not allowed in json objects Binary: expr => `${expr} || ''`,