Re: executing OS programs from pg

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: executing OS programs from pg
Дата
Msg-id 12059.1117826189@sss.pgh.pa.us
обсуждение исходный текст
Ответ на executing OS programs from pg  ("Gevik babakhani" <gevik@xs4all.nl>)
Список pgsql-hackers
"Gevik babakhani" <gevik@xs4all.nl> writes:
> Does anyone know how to execute an OS command from pgsql. I would like to
> create a trigger that op on firing would run/execute an external program.

Use any of the "untrusted" PLs to execute system() or the like.

Whether this is a good idea or not is a different question --- there are
excellent reasons why it is a *bad* idea to execute outside-the-database
actions from within a trigger.  Mainly that the actions won't be undone
if the transaction later rolls back, and now your database state is
inconsistent with outside-the-database state.  See the list archives for
many past discussions of this point and safer ways to design your
application.

(BTW, this is hardly material for -hackers.)
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Luke Lonergan"
Дата:
Сообщение: Re: NOLOGGING option, or ?
Следующее
От: Bruno Wolff III
Дата:
Сообщение: Re: executing OS programs from pg