A klip on my dashboard stooped working out of nowhere.
The Klip worked for more than 2 years, and one day it simply started to get an error.
It uses the query:
select
i.product_name as product,
sum((i.cart_price-i.coupon_discount_amount-coalesce(i.drops_discount_amount,0)) * coalesce(drate_brl.value, 1)) as revenue,
TO_CHAR(o.checkout_at::date AT TIME ZONE 'UTC' AT TIME ZONE 'America/Sao_Paulo', 'YYYY-MM-DD') as "checkout_date",
coalesce(TO_CHAR(date_trunc('day', sp.released_on__all::date AT TIME ZONE 'UTC' AT TIME ZONE 'America/Sao_Paulo'), 'YYYY-MM-DD'),(TO_CHAR(date_trunc('day', sp.published_at::date AT TIME ZONE 'UTC' AT TIME ZONE 'America/Sao_Paulo'), 'YYYY-MM-DD'))) as publish_date,
case when provider_publisher_name in ('Microsoft Xbox', 'Nintendo', 'Sony PlayStation') then 'Console' else 'PC' end as "Plataforma"
FROM "transactions"."orders" as o
left join "transactions"."order_items" as i ON o.id = i.order_id
left join "store"."products" as sp ON i.product_id = sp._id
left join exchange_rates.daily_rates drate_brl ON drate_brl.reference_date = date_trunc('day', o.checkout_at) AND drate_brl.base_currency_code = o.customer_currency_code AND drate_brl.target_currency_code = 'BRL'
WHERE date_trunc('day',o.checkout_at::date AT TIME ZONE 'UTC' AT TIME ZONE 'America/Sao_Paulo') >= '{props.iDateMetaFilter}'
AND date_trunc('day',o.checkout_at::date AT TIME ZONE 'UTC' AT TIME ZONE 'America/Sao_Paulo') <= '{props.eDateMetaFilter}'
AND i.customer_final_price > 0
AND (o.control_payment_status = '7' OR o.control_payment_status='8')
AND i.control_item_status = '3'
group by product,publish_date,checkout_date,Plataforma
order by product
No changes were made to the database or anything, the datasource isn't updating anymore and the following error occurs:
SQL Error: ERROR: invalid input syntax for type timestamp: "3"