From: Tom Lane <tgl@sss.pgh.pa.us>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: David Gauthier <davegauthierpg@gmail.com>
Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Run external command as part of an sql statement ?
Date: Mon, 07 May 2018 17:52:22 -0400
Message-ID: <11260.1525729942@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKFQuwYWhVm6bzCtXL5wuiFO1wj_9QA-JURNHyv2ZdEJTY2nBg@mail.gmail.com>
References: <CAMBRECD0cW4mvg_ZfRX=qW8iJanCVjQU+j=Yx5J7jbn4uBSZ2Q@mail.gmail.com>
<CAKFQuwYWhVm6bzCtXL5wuiFO1wj_9QA-JURNHyv2ZdEJTY2nBg@mail.gmail.com>
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Mon, May 7, 2018 at 2:35 PM, David Gauthier <davegauthierpg@gmail.com>
> wrote:
>> I want to be able to run a shell command like this from within a stored
>> procedure. Is there a way to do this ?
> In core, you can probably use the untrusted​ version of Perl, Python, or
> Tcl to accomplish your goal. SQL and pl/pgSQL do not provide that
> capability.​
Depending on what you want to do, COPY TO/FROM PROGRAM might be a
serviceable option. But, just like the untrusted-PL variants, you
need to be superuser. Keep in mind that the program will run as
the database server owner (which is the reason for the superuser
restriction).
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, david.g.johnston@gmail.com, davegauthierpg@gmail.com
Subject: Re: Run external command as part of an sql statement ?
In-Reply-To: <11260.1525729942@sss.pgh.pa.us>
References: <CAMBRECD0cW4mvg_ZfRX=qW8iJanCVjQU+j=Yx5J7jbn4uBSZ2Q@mail.gmail.com> <CAKFQuwYWhVm6bzCtXL5wuiFO1wj_9QA-JURNHyv2ZdEJTY2nBg@mail.gmail.com> <11260.1525729942@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox