Larry
Larry

Reputation: 11899

Temporal trigger in PostgreSQL DB

Is it possible to define a temporal (i.e. time/date based trigger) in PostgreSQL?

Consider I store a table with some data, that also contains a field for timestamp. This timestamp field is the date/time that I want a certain function to be triggered?

Is it possible to associate a trigger with this table, that can execute the desired trigger at the given time?

Upvotes: 1

Views: 930

Answers (3)

Erwin Brandstetter
Erwin Brandstetter

Reputation: 656391

Or use cron-jobs on a UNIX / LINUX systems. Something like

psql -p5432 mydb -c 'SELECT myfunction()'

as system user postgres which is set up to log in without password.

Upvotes: 1

Frank Heikens
Frank Heikens

Reputation: 126991

This is what pgAgent does.

Upvotes: 1

user330315
user330315

Reputation:

No, this is not possible. Triggers are only fired through SQL statements (INSERT, UPDATE, DELETE)

Upvotes: 0

Related Questions