Subject: System call in C function

From: "Raymond Frost (305) 284-3969" <[email-masked]>
Date: Mon, 27 Apr 92 13:56:00 -0700

I am trying to execute a system call from withing a C
function.  I wrote the following C function:

#include <stdio.h>
char warning()
{
        system("echo hi > /tmp/dog\n");
        return(1>0);
}

The function seems to define and load without any problem.  It also
appears to have gotten as far as the return line since all tuples
are returned.  Yet the file "dog" is never created.

Query sent to backend is "define function warning (   language = "c",                              returntype = bool)       arg is (RELATION)      as "/u/rfrost/postgres/demo/m.o" "
DEFINE
Query sent to backend is "load "/u/rfrost/postgres/demo/m.o" "
LOAD
Query sent to backend is "retrieve (emp.all) where warning(emp)  "
-----------------------------------------------------------------------
| salary      | manager     | location    | age         | name        |
-----------------------------------------------------------------------
| 1000        | sam         | (15,12)     | 25          | sharon      |
-----------------------------------------------------------------------
| 6000        | bill        | (10,5)      | 30          | sam         |
-----------------------------------------------------------------------
| 3000        | sharon      | (11,10)     | 20          | bill        |
-----------------------------------------------------------------------

Thanks in advance,

Raymond Frost
University of Miami

---

From: postarch (Postgres Mailing Archive)
Date: Thu, 30 Apr 92 11:12:15 PDT

> are returned.  Yet the file "dog" is never created.

I'm running the same function and everything appears to work as expected.
Could it be that you're running the front-end on a remote machine?  If
so then /tmp on the server (where postgres lives) is the place where dog
will be created.

Jeff Meredith
[email-masked]