diff --git a/packages/nocodb/src/db/functionMappings/pg.ts b/packages/nocodb/src/db/functionMappings/pg.ts index 5b36f24282..3e1c95a820 100644 --- a/packages/nocodb/src/db/functionMappings/pg.ts +++ b/packages/nocodb/src/db/functionMappings/pg.ts @@ -210,7 +210,7 @@ const pg = { SUBSTR: async ({ fn, knex, pt, colAlias }: MapFnArgs) => { const str = (await fn(pt.arguments[0])).builder; const positionFrom = (await fn(pt.arguments[1] ?? 1)).builder; - const numberOfCharacters = (await fn(pt.arguments[2] ?? '')).builder; + const numberOfCharacters = pt.arguments[2] ? (await fn(pt.arguments[2])).builder : null; return { builder: knex.raw( `SUBSTR(${str}::TEXT, ${positionFrom}${