Re: Executing Shell Command

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Nicholas Walker <nick(at)walkerdatanet(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Executing Shell Command
Date: 2003-11-28 21:17:36
Message-ID: 200311282117.hASLHaW09715@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Wow, you got me on this one. You checked the permissions, and even
tried a hard-coded string. Have you looked in the server logs to see if
it has any more information?

---------------------------------------------------------------------------

Nicholas Walker wrote:
> 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
>
>
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2003-11-28 21:32:21 Re: Restore-point?
Previous Message Tom Lane 2003-11-28 21:17:34 Re: 7.3.4 and 7.4 ORDER in queries