From: listas_quij...@hotmail.com To: pgsql-es-ayuda@postgresql.org Subject: Problema ejecutando funcion en C Date: Tue, 25 Aug 2009 23:57:46 +0000 Hola! Estoy tratando de hacer un par de funciones en C. Las compile bien e incluso las cargue pero al momento de ejecutarlas Postgres me saca del server y me da un error extrano Este es mi codigo en c y el error que me da al tratar de ejecutar las funciones. Solo son dos #include "postgres.h"#include <string.h>#include "fmgr.h"#include <stdio.h>#include <stdlib.h> #ifdef PG_MODULE_MAGICPG_MODULE_MAGIC;#endif PG_FUNCTION_INFO_V1(pg_val_licenses_movil); /* Ejecuta la funcion que determina si la licencia movil es valida para poder usarla */Datumpg_val_licenses_movil(PG_FUNCTION_ARGS) { int32 arg = PG_GETARG_INT32(0); char *cmd = "php getm.php"; char buf[BUFSIZ]; FILE *ptr; if ((ptr = popen(cmd, "r")) != NULL) while (fgets(buf, BUFSIZ, ptr) != NULL) (void) pclose(ptr); PG_RETURN_BOOL(buf[0]!= '0'); } PG_FUNCTION_INFO_V1(pg_val_licenses_desk); /* Ejecuta la funcion que determina si la licencia movil es valida para poder usarla */ Datumpg_val_licenses_desk(PG_FUNCTION_ARGS) { int32 arg = PG_GETARG_INT32(0); char *cmd = "php getd.php"; char buf[BUFSIZ]; FILE *ptr; if ((ptr = popen(cmd, "r")) != NULL) while (fgets(buf, BUFSIZ, ptr) != NULL) (void) pclose(ptr); PG_RETURN_BOOL(buf[0]!= '0'); } This the error to running db_source#select pg_val_licenses_movil(0);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. *-------------------------------------------------------* *-Edwin Quijada *-Developer DataBase *-JQ Microsistemas *-Soporte PostgreSQL *-www.jqmicrosistemas.com *-809-849-8087 *-------------------------------------------------------* _________________________________________________________________