Browse Source

fix(nc-gui): missing result for PG

pull/4644/head
Wing-Kam Wong 2 years ago
parent
commit
eea2c6e5d0
  1. 12
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/formulav2/formulaQueryBuilderv2.ts

12
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/formulav2/formulaQueryBuilderv2.ts

@ -721,6 +721,18 @@ export default async function formulaQueryBuilderv2(
: pt.right.value === ''
: 0
}) ${colAlias}`;
} else if (knex.clientType() === 'pg') {
sql = `COALESCE(${left} ${pt.operator} ${right}, ${
pt.operator === '='
? pt.left.type === 'Literal'
? pt.left.value === ''
: pt.right.value === ''
: pt.operator === '!='
? pt.left.type !== 'Literal'
? pt.left.value === ''
: pt.right.value === ''
: false
}) ${colAlias}`;
}
const query = knex.raw(sql);

Loading…
Cancel
Save