From a6685b924ac000b6aa80642e409e1cd0b87c0bca Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Thu, 10 Nov 2022 18:46:18 +0800 Subject: [PATCH] fix(nocodb): wrap the second argument in formula RIGHT --- .../lib/db/sql-data-mapper/lib/sql/functionMappings/sqlite.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/sqlite.ts b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/sqlite.ts index 4a12f5ee4b..be33bb7606 100644 --- a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/sqlite.ts +++ b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/sqlite.ts @@ -47,9 +47,9 @@ const sqlite3 = { }, 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',