Thread: Excute comnands OS from plpgsql

Excute comnands OS from plpgsql

From
"Edwin Quijada"
Date:
Hi!! Is there a way to execute script in OS from plpgsql???

_________________________________________________________________
Charla con tus amigos en línea mediante MSN Messenger:
http://messenger.yupimsn.com/


Re: Excute comnands OS from plpgsql

From
Pavel Stehule
Date:
Yes, you can use plsh

http://developer.postgresql.org/~petere/plsh.html

regards
Pavel

On Tue, 14 Oct 2003, Edwin Quijada wrote:

> Hi!! Is there a way to execute script in OS from plpgsql???
>
> _________________________________________________________________
> Charla con tus amigos en línea mediante MSN Messenger:
> http://messenger.yupimsn.com/
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>


Re: Excute comnands OS from plpgsql

From
Peter Eisentraut
Date:
Edwin Quijada writes:

> Hi!! Is there a way to execute script in OS from plpgsql???

No, you need to call a function written in an untrusted language, such as
PL/perlu.

--
Peter Eisentraut   peter_e@gmx.net


Re: Excute comnands OS from plpgsql

From
Richard Huxton
Date:
On Tuesday 14 October 2003 16:38, Edwin Quijada wrote:
> Hi!! Is there a way to execute script in OS from plpgsql???

I think there's a pl/sh procedural language (in contrib or gborg iirc), but
you could probably use any of the untrusted procedural languages.

Better, would be to use the LISTEN/NOTIFY feature to talk to an external
daemon that handles things for you, otherwise your script will run as the
same user as the backend.

--
  Richard Huxton
  Archonet Ltd

Re: Excute comnands OS from plpgsql

From
Richard Huxton
Date:
On Tuesday 14 October 2003 17:15, Richard Huxton wrote:
> On Tuesday 14 October 2003 16:38, Edwin Quijada wrote:

> How can I use NOtify to do this?

Please make sure you reply to the list too.

In your daemon you do something like: "LISTEN signal1", and in a trigger (say)
you issue "NOTIFY signal1". Your daemon will receive an asynchronoums message
"signal1" and you can then check the relevant tables for
updates/deletions/whatever signal1 means.

In practice, I usually don't care about responding that quickly, and just have
a cron job start up a script every 5 mins to check a "pending_jobs" table.

--
  Richard Huxton
  Archonet Ltd

Re: Excute comnands OS from plpgsql

From
CoL
Date:
hi,

Pavel Stehule wrote, On 10/14/2003 5:47 PM:
> Yes, you can use plsh
>
> http://developer.postgresql.org/~petere/plsh.html
>
> regards
> Pavel

or plperl, or plphp too :)

C.


Re: Excute comnands OS from plpgsql

From
"scott.marlowe"
Date:
On Tue, 14 Oct 2003, CoL wrote:

> hi,
>
> Pavel Stehule wrote, On 10/14/2003 5:47 PM:
> > Yes, you can use plsh
> >
> > http://developer.postgresql.org/~petere/plsh.html
> >
> > regards
> > Pavel
>
> or plperl, or plphp too :)

I think the new version must run in safe mode, as it installs as a trusted
language, or at least that's the impression I got.

Senior Drake?


Re: Excute comnands OS from plpgsql

From
"Edwin Quijada"
Date:
Well, If I install PL/perl there is a something way that language can be use
just for a few users into a group or entrire group?


>From: "scott.marlowe" <scott.marlowe@ihs.com>
>To: CoL <col@mportal.hu>
>CC: <pgsql-general@postgresql.org>
>Subject: Re: [GENERAL] Excute comnands OS from plpgsql
>Date: Tue, 14 Oct 2003 13:54:37 -0600 (MDT)
>
>On Tue, 14 Oct 2003, CoL wrote:
>
> > hi,
> >
> > Pavel Stehule wrote, On 10/14/2003 5:47 PM:
> > > Yes, you can use plsh
> > >
> > > http://developer.postgresql.org/~petere/plsh.html
> > >
> > > regards
> > > Pavel
> >
> > or plperl, or plphp too :)
>
>I think the new version must run in safe mode, as it installs as a trusted
>language, or at least that's the impression I got.
>
>Senior Drake?
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 5: Have you checked our extensive FAQ?
>
>                http://www.postgresql.org/docs/faqs/FAQ.html

_________________________________________________________________
Charla con tus amigos en línea mediante MSN Messenger:
http://messenger.yupimsn.com/


Re: Excute comnands OS from plpgsql

From
Alvaro Herrera Munoz
Date:
On Tue, Oct 14, 2003 at 08:26:49PM +0000, Edwin Quijada wrote:
> Well, If I install PL/perl there is a something way that language can be
> use just for a few users into a group or entrire group?

You can install the untrusted version (plperlu), create a function with
it, and then give execute privileges to anyone you want, groups
included.

--
Alvaro Herrera (<alvherre[@]dcc.uchile.cl>)
"La libertad es como el dinero; el que no la sabe emplear la pierde" (Alvarez)

Re: Excute comnands OS from plpgsql

From
Jan Wieck
Date:
Richard Huxton wrote:

> On Tuesday 14 October 2003 16:38, Edwin Quijada wrote:
>> Hi!! Is there a way to execute script in OS from plpgsql???
>
> I think there's a pl/sh procedural language (in contrib or gborg iirc), but
> you could probably use any of the untrusted procedural languages.

There is certainly PL/TclU in the core distro.


Jan

--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #


Re: Excute comnands OS from plpgsql

From
CoL
Date:
Hi,

scott.marlowe wrote, On 10/14/2003 9:54 PM:
> On Tue, 14 Oct 2003, CoL wrote:
>
>> hi,
>>
>> Pavel Stehule wrote, On 10/14/2003 5:47 PM:
>> > Yes, you can use plsh
>> >
>> > http://developer.postgresql.org/~petere/plsh.html
>> >
>> > regards
>> > Pavel
>>
>> or plperl, or plphp too :)
>
> I think the new version must run in safe mode, as it installs as a trusted
> language, or at least that's the impression I got.
>
> Senior Drake?

You are right.

C.