Browse Source

fix: pg - make larst arg optional for sustr function

pull/7446/head
Pranav C 10 months ago
parent
commit
7f192a2266
  1. 2
      packages/nocodb/src/db/functionMappings/pg.ts

2
packages/nocodb/src/db/functionMappings/pg.ts

@ -210,7 +210,7 @@ const pg = {
SUBSTR: async ({ fn, knex, pt, colAlias }: MapFnArgs) => { SUBSTR: async ({ fn, knex, pt, colAlias }: MapFnArgs) => {
const str = (await fn(pt.arguments[0])).builder; const str = (await fn(pt.arguments[0])).builder;
const positionFrom = (await fn(pt.arguments[1] ?? 1)).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 { return {
builder: knex.raw( builder: knex.raw(
`SUBSTR(${str}::TEXT, ${positionFrom}${ `SUBSTR(${str}::TEXT, ${positionFrom}${

Loading…
Cancel
Save