Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gG1DW-0002p8-LJ for pgsql-general@arkaria.postgresql.org; Fri, 26 Oct 2018 12:27:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gG1DV-0006C2-8Q for pgsql-general@arkaria.postgresql.org; Fri, 26 Oct 2018 12:27:53 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gG1DV-0006Bu-0E for pgsql-general@lists.postgresql.org; Fri, 26 Oct 2018 12:27:53 +0000 Received: from lungold.riddles.org.uk ([82.68.208.19]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gG1DO-0003PC-OS for pgsql-general@postgresql.org; Fri, 26 Oct 2018 12:27:52 +0000 Received: from [192.168.127.1] (port=20987 helo=caithnard.riddles.org.uk) by lungold.riddles.org.uk with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.88 (FreeBSD)) (envelope-from ) id 1gG1DM-00035m-0P; Fri, 26 Oct 2018 12:27:44 +0000 Received: from [127.0.0.1] (port=58145 helo=caithnard.riddles.org.uk) by caithnard.riddles.org.uk with esmtp (Exim 4.89 (FreeBSD)) (envelope-from ) id 1gG1DL-000NUf-43; Fri, 26 Oct 2018 12:27:43 +0000 From: Andrew Gierth To: Mike Martin Cc: pgsql-general@postgresql.org Subject: Re: Shell Command within function In-Reply-To: (Mike Martin's message of "Fri, 26 Oct 2018 13:22:19 +0100") Message-ID: <87va5o7v3k.fsf@news-spur.riddles.org.uk> References: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (berkeley-unix) Date: Fri, 26 Oct 2018 13:27:42 +0100 MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk >>>>> "Mike" == Mike Martin 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)