From: Andrew Gierth <andrew@tao11.riddles.org.uk>
To: Mike Martin <redtux1@gmail.com>
Cc: pgsql-general@postgresql.org
Subject: Re: Shell Command within function
Date: Fri, 26 Oct 2018 13:27:42 +0100
Message-ID: <87va5o7v3k.fsf@news-spur.riddles.org.uk> (raw)
In-Reply-To: <CAOwYNKZ_+y-qFxwTZLZ-X-2fxFhG0bSLC6dT2TUSY1yYLWPAvg@mail.gmail.com>
References: <CAOwYNKZ_+y-qFxwTZLZ-X-2fxFhG0bSLC6dT2TUSY1yYLWPAvg@mail.gmail.com>
>>>>> "Mike" == Mike Martin <redtux1@gmail.com> writes:
Mike> Is this possible?
In an untrusted pl language, yes, but it's a bad idea because:
Mike> I have a script which imports csvlogs into a table, and it would
Mike> be useful to truncate the log files after import
If you had an error after truncating the file but before committing the
transaction, then the imported data would be gone, but the file would be
gone too, so you'd have lost it.
Things like this need to be handled _after_ commit, not before, so a
function is the wrong place for it.
--
Andrew (irc:RhodiumToad)
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: andrew@tao11.riddles.org.uk, redtux1@gmail.com
Subject: Re: Shell Command within function
In-Reply-To: <87va5o7v3k.fsf@news-spur.riddles.org.uk>
References: <CAOwYNKZ_+y-qFxwTZLZ-X-2fxFhG0bSLC6dT2TUSY1yYLWPAvg@mail.gmail.com> <87va5o7v3k.fsf@news-spur.riddles.org.uk>
* 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