Postgresql – How to trigger an event when row column crosses now()

postgresqltrigger

Is it somehow possible in postgres 12 to trigger an event when a table with an tsrange column crosses now(), or someone insert something that where the tsrange is prior to now()?

Triggers, as far i know, only triggers when someone insert or updates a row.

Triggering when someone insert a row which has passed now, seem to doable
With trigger that triggers on all inserts, but i am not sure how to trigger an event, when a given timestamp in that row crosses now..

And can both trigger scenarios be combined into one?

Best Answer

You'd have to schedule a program to run regularly and process the table.

Usually it is better to implement such logic in the SELECT statements.