Browse Source

fix: cast to date only if necessary

pull/7268/head
Pranav C 11 months ago
parent
commit
656d5fd9e2
  1. 6
      packages/nocodb/src/db/functionMappings/pg.ts

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

@ -57,9 +57,9 @@ const pg = {
DATEADD: async ({ fn, knex, pt, colAlias }: MapFnArgs) => {
return {
builder: knex.raw(
`(${(await fn(pt.arguments[0])).builder})::DATE + (${
(await fn(pt.arguments[1])).builder
} ||
`(${(await fn(pt.arguments[0])).builder})${
pt.arguments[0].type !== 'DATE' ? '::DATE' : ''
} + (${(await fn(pt.arguments[1])).builder} ||
'${String((await fn(pt.arguments[2])).builder).replace(
/["']/g,
'',

Loading…
Cancel
Save