From 95ac2fe825233b0ff8455731bb11bea8f1f6473f Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Tue, 28 Feb 2023 00:07:38 +0800 Subject: [PATCH] fix(nocodb): escape ? for raw sql query --- .../sql-data-mapper/lib/sql/formulav2/formulaQueryBuilderv2.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/formulav2/formulaQueryBuilderv2.ts b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/formulav2/formulaQueryBuilderv2.ts index c7c2b37197..27ed28bf85 100644 --- a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/formulav2/formulaQueryBuilderv2.ts +++ b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/formulav2/formulaQueryBuilderv2.ts @@ -753,7 +753,7 @@ async function _formulaQueryBuilder( sql = `${sql} ${colAlias}`; } } - const query = knex.raw(sql); + const query = knex.raw(sql.replace(/\?/g, '\\?')); if (prevBinaryOp && pt.operator !== prevBinaryOp) { query.wrap('(', ')'); }