Subject: C function in postgres

From: "Raymond Frost (305) 284-3969" <[email-masked]>
Date: Thu, 30 Apr 92 14:33:26 -0700

I wrote:

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

You replied:

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

I am running the front-end and back-end on the same Decstation 5000
under Ultrix 4.0.  To make the function load I had to add:

	extern system()
	SymbolDecl(system)

to dec/dynamic_syms.c as you recommended in a previous message and 
then issue:

	Make postgres install

Is my problem that I'm running Ultrix 4.0 or is it something else?

Raymond Frost
University of Miami

---

From: postarch (Postgres Mailing Archive)
Date: Fri, 01 May 92 11:17:37 PDT

> Is my problem that I'm running Ultrix 4.0 or is it something else?

My 5000 is running Ultrix 4.1 so I think it is probably something else.

Sounds like you picked the wrong port when you installed.  You should
have chosen ultrix4.  If you had you wouldn't need to have messed around
with dynamic loader code.  I don't know if this is the reason for your
problem, but it is probably a good place to start.  To change ports you
will need to run the following:

	rm -rf $POSTGRESHOME/obj.dec
	cd $POSTGRESHOME/newconf
	newport
	Make everything install

When newport prompts for the new port to use make sure to pick ultrix4.

Jeff Meredith
[email-masked]