Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2009
    Posts
    1

    Unanswered: Calling a Shell Script / PHP Script from a Trigger in PostgreSQL

    I am currently working on the phase when I am suppose to update the database / fire a trigger in case a field for current_state is set is HIGH I should execute a shell script for the same.

    The script works in collaboration with Xen tools so as to create new VM's. I am new to postgreSQL so I am unable to get the same done. Please provide the answer or an example for the same.

    Does postgreSQL support exec, system or any such related commands for the above action.

    Please reply ASAP.

  2. #2
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    Maybe using PL/sh
    PostgreSQL: Documentation: Manuals: PostgreSQL 8.4: Procedural Languages

    Then your trigger would simply call a stored procedure that is written in PL/sh

    Please reply ASAP.
    Please leave out those comments in the future. This is not a paid support forum.
    And I'm sure anyone who answers does this "as soon as it's possible for him/her"

  3. #3
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    Write the trigger-function using an untrusted language like PL/TclU, PL/PerlU, or PL/PythonU. (Note the 'U' at the end...) You can call arbitrary commands within an untrusted language. With the regular trusted languages (such plpgsql, PL/Perl or the like) you can't call external programs.
    Last edited by loquin; 07-30-09 at 17:18.
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •