Re: [GENERAL] daily check for expired data ?

From: Herouth Maoz <herouth(at)oumail(dot)openu(dot)ac(dot)il>
To: Ralf Weidemann <Finc01(at)DX1(dot)HRZ(dot)Uni-Dortmund(dot)DE>, PGSQL-GENERAL-ML <pgsql-general(at)postgreSQL(dot)org>
Subject: Re: [GENERAL] daily check for expired data ?
Date: 1999-03-14 13:29:47
Message-ID: l03110707b31169283e16@[147.233.159.109]
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

At 22:48 +0200 on 11/3/99, Ralf Weidemann wrote:

>
> how could I do an automatic daily check
> to delete some expired data ? I mean
> can I have a cron functionality in post-
> gresql ?

You don't need to have cron functionality in postgresql when you have cron
functionality in cron. :)

What you have to do is make a simple script, more or less like this:

#!/usr/bin/sh
PGHOST=...
PGPORT=...
PGUSER=...
psql my_database <<END_SQL
DELETE FROM table_in_question
WHERE datetime_field < ( 'now'::datetime - '1 day'::timespan );
END_SQL

And then run it with cron...

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Somnath Banerjee 1999-03-14 14:48:32 User experiences
Previous Message Henk Jan Barendregt 1999-03-14 10:54:24 Error building pg 6.4 on RH Linux