Reputation: 7503
I am new to PostgresSQL where I am running one query where I am looking for activities within last week but it is throwing out of range error
Postgres SQL:
select *
from myTable
where order_time > '2018-12-04 18:22:26' - INTERVAL '7 day'
Error:
IntervalFieldOverflow: ERROR: interval field value out of range: "2018-12-04 18:22:26"
Version: PostgresSQL 9.6
I have tried to resolve my issue by searching online but did not get much help.
Upvotes: 5
Views: 4046
Reputation: 520878
Try casting the timestamp literal string:
select *
from myTable
where order_time > '2018-12-04 18:22:26'::timestamp - interval '7 day';
Upvotes: 8