Edwin Quijada escribió:
> 
> 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

No se puede leer muy bien, pero el error significa que Postgres se cae
porque tu programa tiene algún error.  Si miras en el log probablemente
veas que se muere por una señal 11 o algo parecido.

¿No sería más sencillo usar PL/php para invocar tus programas PHP?

> 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.


-- 
Alvaro Herrera                         http://www.flickr.com/photos/alvherre/
"Executive Executive Summary: The [Windows] Vista Content Protection
 specification could very well constitute the longest suicide note in history."
      Peter Guttman, http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt
--
TIP 4: No hagas 'kill -9' a postmaster

Responder a