I would like each database to encapsulate its own backup procedure.

Each database contains a table (fsyslog) which has a record of each backup taken:
<rowid><Operator><timestamp><destination path>

At the application level I presently
a) check for time since the last backup
b) if older than <x> hrs
     (i) perform a vacuum analyze
     (ii) force a call to dbbackup
     (iii) add a new record into fsyslog

I would like to add a procedure to the database that does the backup and thus ensure that all applications use the same methodology.

The procedure would take only the backup path as a parameter.

presently I send the command :

pch := pchar('pg_dump -C -h '+host+' -U '+usr+' -p '+pswd+ ' -f '+bckup_path+' '+dbase);

to postgres.

as the operator is obviously logged in how do I
(1) trap their user id
(2) Send the call to pg_dump without knowing their password?

I expect this is a well worn route and am hoping not to have to reinvent a wheel.

thanks very much as always

Richard



---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

              http://archives.postgresql.org

Reply via email to