Blagoj,

* Blagoj Petrushev (b.petrus...@gmail.com) wrote:
> The rows that match the `my_condition` will be deleted when the
> current timestamp reaches my_timestamp or, in the second case, exactly
> my_interval time after the execution.

An in-PG version of cron has been discussed before and seems like it
would meet your need here.  It's certainly something which I would like
to see happen, most likely using the background worker infrastructure.
I don't know of anyone actively working on it though.

Your proposal does have the interesting property that it could be
implemented without a cron-like process by keeping track of the
expiration time and then just ignoring the records even if they're
there.  That could be done with a view, of course, but as you point out,
it'd need backend/core support if it's going to work for FK
relationships or similar.

> As a consequence, a row function ttl(), i.e. time-to-live, would be
> appropriate (not quite clear about this, though). Basically, would
> return an interval until the deletion of the row takes place, or none
> if the there's no expiration scheduled.

For a view-based approcah, this function could be trivially written to
go against the underlying table to return the answer.

        Thanks,

                Stephen

Attachment: signature.asc
Description: Digital signature

Reply via email to