Error in function to pg_dump: Standard in must be a tty

From: "Siew Hui, Wong" <shwong(at)sebasasia(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Error in function to pg_dump: Standard in must be a tty
Date: 2004-04-09 03:27:49
Message-ID: 002901c41de2$d762d750$3c0a0a0a@siewhui
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Postgresql 7.3.4
RH 8.0

Hello all,

The client requirements are that from the website(a coldfusionmx app), they
could backup and restore the database from the list of backups available.
All i've given to work on is just that to allow user to select backup to
restore and also to allow user to perform a manual database backup.

Here's how the "manual backup" process goes. When user clicks on "Backup
Database Now", a row is inserted to a table (app_dbactionb) to trigger off
the pg_dump. Problem is an error msg appeared when i insert test data into
table:

"standard in must be a tty."

Below are the functions and trigger concerned:
###################################
CREATE TRIGGER autobackup
AFTER INSERT ON app_dbactionb
FOR EACH ROW
EXECUTE PROCEDURE initbackup ();

CREATE FUNCTION initbackup () RETURNS "trigger" AS '
begin
perform Backup ();
return NEW;
end;
' LANGUAGE 'plpgsql';

CREATE FUNCTION backup () RETURNS integer
AS '
system("/home/postgres/testbackupdb");
return 0;
'LANGUAGE plperlu;
###################################

Below is the testbackupdb (chmod 777, owner postgres):

#!/bin/bash
#File is named according to abbreviation of week name (Sun...Sat)
#e.g. nsvm_Mon_2004.db

backupdate=`date +%a_%Y`
/bin/su - postgres -c "/usr/local/pgsql/bin/pg_dump -f
/home/postgres/nsvm_$backupdate.db nsvm"
echo "Backup at `date` :
nsvm_$backupdate.db">>/home/postgres/nsvm_backup_log

I really appreciate any form of advice and feedback on this error. Please
let me know too, if there are more efficient ways to allow user to backup
from a webpage :) Thank you all for the time.

Best regards,
siew hui

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2004-04-09 03:52:03 Re: Orphaned trigger -- bug?
Previous Message Tom Lane 2004-04-09 03:19:00 Re: ERROR: invalid memory alloc request size 0