sorry to bother u ppl again. another question. is it possible to execute a shell command in pl/pgsql function? please advice . and i really appreciate for those of u who replied to my thread. thanks a lot. good day.
I'm not going to say that it can't be done, because someone may have figured out a way to do it. Usually the code that would be a shell script is incorporated into a postgres function. Postgres can execute functions in the following languages:
PL/pgsql
PL\tcl
PL\perl
PL\python
The following link will explain about client interfaces available under postgres; although, it isn't nearly complete. For example, I use Visual FoxPro 7 as a front-end to postgres and it is excellent, but there is no mention of it under "I. Client Interfaces". "II. Server Programming" explain how you can program postgres on the server side including procedural languages, and "III. Procedural Languages" list langauages available to build functions under postgres. If you want to use perl, tlk, or python to write your scripts, you must compile support for your language of choice into postgres.
Yes, if you install Perl as a procedural language in "untrusted" mode ('plperlu', instead of 'plperl'). This means that you can use Perl as a procedural language, with full access to the system resources. Thus, perl can call an external shell script.
I understand there are times when this can be a neat advantage with PostgreSQL, but use with care. -------------------------------------------
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.