From 063ed40a607c9a850d8a5b83ee4d10b34391fcd9 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Wed, 30 Nov 2022 16:31:47 +0800 Subject: [PATCH] fix(nocodb): cast char first before casting as double for FLOAT --- .../lib/db/sql-data-mapper/lib/sql/functionMappings/mysql.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/mysql.ts b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/mysql.ts index 9aedd96097..1419ca36e9 100644 --- a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/mysql.ts +++ b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/mysql.ts @@ -36,7 +36,7 @@ const mysql2 = { MID: 'SUBSTR', FLOAT: (args: MapFnArgs) => { return args.knex - .raw(`CAST(${args.fn(args.pt.arguments[0])} as DOUBLE)${args.colAlias}`) + .raw(`CAST(CAST(${args.fn(args.pt.arguments[0])} as CHAR) AS DOUBLE)${args.colAlias}`) .wrap('(', ')'); }, DATEADD: ({ fn, knex, pt, colAlias }: MapFnArgs) => {