Hola ! Estoy tvez ratando de hacer una funcion en C que me haga un dump de la 
BD para que dicha funcion sea invocada desde postgres y una app hecha en PHP 
para hacer BK, claro va al server y de ahi por FTP a otro sitio y.... bla bla
el punto es que cada vez que la corro me manda un error


Esta es la funcion::

Datum
pg_backup(PG_FUNCTION_ARGS)
{
  int32 arg = PG_GETARG_INT32(0);
  char *cmd = "/usr/local/pgsql/bin/pg_dump -a --disable-triggers db_lotonet > 
/home/pub/backup.sql";

  char *arch = "/usr/local/pgsql/bin/pg_dump";
  FILE *fp;

  if ((fp = fopen(arch,"r"))==NULL) {PG_RETURN_BOOL(false);}

system("rm -f /home/pub/backup.sql");
system(cmd);

  PG_RETURN_BOOL(true);
}

Y esto me da al correrlo

db_net=# select pg_backup(1);
server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
!>

En log no consigo mucho que digamos..

*-------------------------------------------------------* 
*-Edwin Quijada 
*-Developer DataBase 
*-JQ Microsistemas 

*-Soporte PostgreSQL

*-www.jqmicrosistemas.com
*-809-849-8087
*-------------------------------------------------------*




_________________________________________________________________

Responder a