'Notify using postgresql intervals
Say, like I have a table videoplan:
create table video_plan(
id integer,
startdate timestamp,
enddate timestamp)
So I'm having startdate: 01.02.2022, enddate: 28.02.2022
Here, I need to show a notification like 'Renew Plan' 1 week before the enddate. How to get that in PostgreSQL?
Solution 1:[1]
The database won't notify you. You have to query regularly with something like
SELECT ...
FROM video_plan
WHERE enddate < current_timestamp + INTERVAL '1 week';
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Laurenz Albe |
