Executing Shell Command

Поиск
Список
Период
Сортировка
От Nicholas Walker
Тема Executing Shell Command
Дата
Msg-id 000501c3b48d$302efcc0$030aa8c0@walkeris.com
обсуждение исходный текст
Ответы Re: Executing Shell Command  (Bruce Momjian <pgman@candle.pha.pa.us>)
Re: Executing Shell Command  (Joe Conway <mail@joeconway.com>)
Список pgsql-general

I have been trying to execute a shell command from within postgresql

 

My C Function

 

#include <stdlib.h>

#include<postgres.h>

 

 

 void shell_exec(text arg)

 {

     system(arg.vl_dat);

 }

 

The function in postgres

 

CREATE FUNCTION xp_shellexec(text) RETURNS void

      AS '/home/psql/cfuncs/shellexec', 'shell_exec'

      LANGUAGE C STRICT;

 

Then run SELECT xp_shellexec(mkdir /home/psql/testing’)

 

No error message, it runs, but the directory isn’t created.

 

The C function works if I compile it, and run myself from the shell,

And I even just tried doing this:

void shell_exec(text arg)

 {

     system(mkdir /home/psql/testing”);

 }

 

and it still didn’t work…

the directory has rwx permissions for everyone

I am running freebsd 5.1, and the most recent version of postgres

 

Can someone give me some help?

 

Thanks

 

 

 

В списке pgsql-general по дате отправления:

Предыдущее
От: "Tim Semmelhaack"
Дата:
Сообщение: Re: Connecting Openoffice Postgres
Следующее
От: "Mujdat Pakkan"
Дата:
Сообщение: rules and return values question