Browse Source

fix: REGEX_EXTRACT - formula function correction

pull/7019/head
Pranav C 1 year ago
parent
commit
4bcf91fd03
  1. 2
      packages/nc-gui/utils/formulaUtils.ts
  2. 4
      packages/nocodb/src/db/functionMappings/pg.ts

2
packages/nc-gui/utils/formulaUtils.ts

@ -482,7 +482,7 @@ const formulas: Record<string, any> = {
rqd: 0, rqd: 0,
}, },
}, },
description: 'Returns an empty string.', description: 'Returns a blank value.',
syntax: 'BLANK()', syntax: 'BLANK()',
examples: ['BLANK()'], examples: ['BLANK()'],
}, },

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

@ -201,7 +201,9 @@ const pg = {
const pattern = (await fn(pt.arguments[1])).builder; const pattern = (await fn(pt.arguments[1])).builder;
return { return {
builder: knex.raw( builder: knex.raw(
`REGEXP_MATCHES(${source}::text, ${pattern}::text) ${colAlias}`, // use `SUBSTRING` since REGEXP_MATCH returns array value
// `REGEXP_MATCH(${source}::text, ${pattern}::text) ${colAlias}`,
`SUBSTRING(${source}::text from ${pattern}::text) ${colAlias}`,
), ),
}; };
}, },

Loading…
Cancel
Save