Skip to content

Commit

Permalink
pg trunc fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mtoy-googly-moogly committed Aug 28, 2024
1 parent d0deca6 commit 7fa7d47
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/malloy/src/dialect/pg_impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export abstract class PostgresBase extends Dialect {
sqlTruncExpr(qi: QueryInfo, df: TimeTruncExpr): string {
// adjusting for monday/sunday weeks
const week = df.units === 'week';
const truncThis = week ? `${df.e.sql} + INTERVAL 1 DAY` : df.e.sql;
const truncThis = week ? `${df.e.sql} + INTERVAL '1' DAY` : df.e.sql;
if (df.e.dataType === 'timestamp') {
const tz = qtz(qi);
if (tz) {
Expand All @@ -41,7 +41,7 @@ export abstract class PostgresBase extends Dialect {
}
let result = `DATE_TRUNC('${df.units}', ${truncThis})`;
if (week) {
result = `(${result} - INTERVAL 1 DAY)`;
result = `(${result} - INTERVAL '1' DAY)`;
}
return result;
}
Expand Down

0 comments on commit 7fa7d47

Please sign in to comment.