Running Postgres 7.4 (Yep upgrading)
I see a few threads about this but nothing in the way of syntax and I’m not sure if it can be accomplished.
Looking to run a trigger if timestamp is greater than one hour (timestamp > CURRENT_TIMESTAMP - 1 'HOUR')
I know I can do this with a script in cron but wanted to know if I could just run a trigger on the database?
It is not possible to run something periodically in Postgres database. You should use cron.
You can simulate something like cron using trigger on busy table which checks if it was run more than an hour ago, but it would be complicated and not reliable. Stick with cron.
And timestamp greater than an hour does not make any sense — yo can not compare a moment in time with a duration.