Unverified Commit aae7ec8d authored by Colin Holzman's avatar Colin Holzman Committed by GitHub

fix: calendar filter (#4942)

parent 4d6042e3
...@@ -222,7 +222,7 @@ func (d *PostgreSQLDialect) GetBooleanCheck(path string) string { ...@@ -222,7 +222,7 @@ func (d *PostgreSQLDialect) GetBooleanCheck(path string) string {
} }
func (d *PostgreSQLDialect) GetTimestampComparison(field string) string { func (d *PostgreSQLDialect) GetTimestampComparison(field string) string {
return fmt.Sprintf("EXTRACT(EPOCH FROM %s.%s)", d.GetTablePrefix(), field) return fmt.Sprintf("EXTRACT(EPOCH FROM TO_TIMESTAMP(%s.%s))", d.GetTablePrefix(), field)
} }
func (*PostgreSQLDialect) GetCurrentTimestamp() string { func (*PostgreSQLDialect) GetCurrentTimestamp() string {
......
...@@ -92,7 +92,7 @@ func TestConvertExprToSQL(t *testing.T) { ...@@ -92,7 +92,7 @@ func TestConvertExprToSQL(t *testing.T) {
}, },
{ {
filter: `created_ts > now() - 60 * 60 * 24`, filter: `created_ts > now() - 60 * 60 * 24`,
want: "EXTRACT(EPOCH FROM memo.created_ts) > $1", want: "EXTRACT(EPOCH FROM TO_TIMESTAMP(memo.created_ts)) > $1",
args: []any{time.Now().Unix() - 60*60*24}, args: []any{time.Now().Unix() - 60*60*24},
}, },
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment