From aac0ce28c24d4e65d5ea214ec9ea4a2b73d1133d Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Thu, 10 Nov 2022 10:22:45 +0800 Subject: [PATCH] fix(nocodb): wrap the second argument in formula RIGHT --- .../lib/db/sql-data-mapper/lib/sql/functionMappings/mysql.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 babad78588..9aedd96097 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 @@ -28,9 +28,9 @@ const mysql2 = { }, RIGHT: (args: MapFnArgs) => { return args.knex.raw( - `SUBSTR(${args.fn(args.pt.arguments[0])},-${args.fn( + `SUBSTR(${args.fn(args.pt.arguments[0])}, -(${args.fn( args.pt.arguments[1] - )})${args.colAlias}` + )}))${args.colAlias}` ); }, MID: 'SUBSTR',