Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion postgres/lib/PostgresService.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')}')`
Expand Down
2 changes: 1 addition & 1 deletion sqlite/lib/SQLiteService.js
Original file line number Diff line number Diff line change
Expand Up @@ -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} || ''`,
Expand Down
Loading