By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,835 Members | 2,305 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,835 IT Pros & Developers. It's quick & easy.

Excute comnands OS from plpgsql

P: n/a
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 ma*******@postgresql.org

Nov 12 '05 #1
Share this Question
Share on Google+
12 Replies


P: n/a
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 ma*******@postgresql.org

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 12 '05 #2

P: n/a
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 pe*****@gmx.net
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 12 '05 #3

P: n/a
CoL
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.

Nov 12 '05 #4

P: n/a
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

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 12 '05 #5

P: n/a
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

Nov 12 '05 #6

P: n/a
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

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 12 '05 #7

P: n/a
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. #
#================================================= = Ja******@Yahoo.com #
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 12 '05 #8

P: n/a
CoL
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.

Nov 12 '05 #9

P: n/a
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

Nov 12 '05 #10

P: n/a
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. #
#================================================= = Ja******@Yahoo.com #
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 12 '05 #11

P: n/a
CoL
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.
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 12 '05 #12

P: n/a
CoL
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.
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 12 '05 #13

This discussion thread is closed

Replies have been disabled for this discussion.