Browse Source

fix: missing fractional part in VALUE function output

pull/7268/head
Pranav C 1 year ago
parent
commit
80ca3cb99d
  1. 4
      packages/nocodb/src/db/functionMappings/pg.ts

4
packages/nocodb/src/db/functionMappings/pg.ts

@ -263,11 +263,11 @@ const pg = {
return {
builder: knex.raw(
`ROUND(CASE
`CASE
WHEN ${value} IS NULL OR REGEXP_REPLACE(${value}::TEXT, '[^\\d.]+', '', 'g') IN ('.', '') OR LENGTH(REGEXP_REPLACE(${value}::TEXT, '[^.]+', '', 'g')) > 1 THEN NULL
WHEN LENGTH(REGEXP_REPLACE(${value}::TEXT, '[^%]', '','g')) > 0 THEN POW(-1, LENGTH(REGEXP_REPLACE(${value}::TEXT, '[^-]','', 'g'))) * (REGEXP_REPLACE(${value}::TEXT, '[^\\d.]+', '', 'g'))::NUMERIC / 100
ELSE POW(-1, LENGTH(REGEXP_REPLACE(${value}::TEXT, '[^-]', '', 'g'))) * (REGEXP_REPLACE(${value}::TEXT, '[^\\d.]+', '', 'g'))::NUMERIC
END) ${colAlias}`,
END ${colAlias}`,
),
};
},

Loading…
Cancel
Save