Browse Source

fix(nocodb): postgres datetime_diff year sql

pull/4821/head
Wing-Kam Wong 2 years ago
parent
commit
a04d62ab49
  1. 2
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/pg.ts

2
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/pg.ts

@ -91,7 +91,7 @@ const pg = {
DATE_PART('year', AGE(${datetime_expr2}, '1900/01/01')) * 4) - 1)`;
break;
case 'year':
sql = `DATE_PART('year', ${datetime_expr1}::TIMESTAMP) - DATE_PART('year', ${datetime_expr2}::TIMESTAMP)`;
sql = `DATE_PART('year', age(${datetime_expr1}, ${datetime_expr2}))`;
break;
case 'day':
sql = `DATE_PART('day', ${datetime_expr1}::TIMESTAMP - ${datetime_expr2}::TIMESTAMP)`;

Loading…
Cancel
Save