Dear Metabase Support Team,
I hope this message finds you well. I am currently using Metabase to query a PostgreSQL database, and I would like to clarify a situation regarding field filters for a TIMESTAMPTZ column, specifically the created_at field.
Context:
The created_at field in my database is of type TIMESTAMPTZ NULL.
I want to use a Field Filter in Metabase for this column without performing explicit casting in my SQL queries.
I have ensured that the field type in the Metabase Data Model is set correctly as a Timestamp and the filter widget is configured as a Date filter.
Issue:
When applying a Field Filter in my query like this:
AND {{created_at}}
I notice that Metabase still performs implicit casting in the SQL generated, which I would like to avoid. Here's an example of my query:
SELECT date_trunc('day', created_at)::date AS "Day",
COUNT(order_id) AS "Total Orders",
round(SUM(total_amt)) AS "Total Revenue",
(round((SUM(total_amt))/(count(order_id)))) as "AoV"
FROM "Orders"
WHERE order_source = 'Shopify'
and order_type in ('Paid' ,'Subscription')
and canceled_at is null
AND CAST("public"."Orders"."created_at" AS date) = timestamp with time zone '2024-10-03 00:00:00.000+05:30'
GROUP BY 1
order by 1
I would like to confirm the correct setup for using the created_at field filter in such a way that no casting is applied in the generated SQL, and Metabase handles the TIMESTAMPTZ type natively during the filtering process.
Could you please guide me on how to configure the Field Filter for this timestamp field appropriately, so it avoids any casting while still allowing proper date-based filtering?
I appreciate your assistance and look forward to your guidance.