Excute comnands OS from plpgsql

Started by Edwin Quijadaover 22 years ago11 messagesgeneral
Jump to latest
#1Edwin Quijada
listas_quijada@hotmail.com

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/

#2Pavel Stehule
pavel.stehule@gmail.com
In reply to: Edwin Quijada (#1)
Re: Excute comnands OS from plpgsql

Yes, you can use plsh

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

regards
Pavel

On Tue, 14 Oct 2003, Edwin Quijada wrote:

Show quoted text

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

#3Peter Eisentraut
peter_e@gmx.net
In reply to: Edwin Quijada (#1)
Re: Excute comnands OS from plpgsql

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

#4Richard Huxton
dev@archonet.com
In reply to: Edwin Quijada (#1)
Re: Excute comnands OS from plpgsql

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

#5Richard Huxton
dev@archonet.com
In reply to: Richard Huxton (#4)
Re: Excute comnands OS from plpgsql

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

#6CoL
col@mportal.hu
In reply to: Pavel Stehule (#2)
Re: Excute comnands OS from plpgsql

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.

#7scott.marlowe
scott.marlowe@ihs.com
In reply to: CoL (#6)
Re: Excute comnands OS from plpgsql

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?

#8CoL
col@mportal.hu
In reply to: scott.marlowe (#7)
Re: Excute comnands OS from plpgsql

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.

#9Edwin Quijada
listas_quijada@hotmail.com
In reply to: CoL (#8)
Re: Excute comnands OS from plpgsql

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/

#10Alvaro Herrera
alvherre@dcc.uchile.cl
In reply to: Edwin Quijada (#9)
Re: Excute comnands OS from plpgsql

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)

#11Jan Wieck
JanWieck@Yahoo.com
In reply to: Richard Huxton (#4)
Re: Excute comnands OS from plpgsql

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 #