Re: psql question: aborting a "script"

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "'John McKown *EXTERN*'" <john(dot)archie(dot)mckown(at)gmail(dot)com>, "PostgreSQL General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: psql question: aborting a "script"
Date: 2016-03-15 15:02:46
Message-ID: A737B7A37273E048B164557ADEF4A58B5380ED62@ntex2010i.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

John McKown wrote:
> I'm likely abusing the psql program. What I have is an awk program which reads a file and produces a
> number of INSERT INTO commands. I then feed these commands into psql to execute them. Yes, a Perl
> program would be a better idea. Anyway, sometimes the commands are rejected due to some problem, such
> as duplicate primary key. What I wish is that the psql command had a switch, or control command, which
> would say "exit from psql if anything fails". To me, this is like the BASH "set -e" command for a
> shell script. Does this sound like a useful addition. Or am I just missing where it already exists?

Did you try "psql -v ON_ERROR_STOP=on"?

Yours,
Laurenz Albe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Francisco Olarte 2016-03-15 15:05:03 Re: psql question: aborting a "script"
Previous Message John McKown 2016-03-15 15:02:40 Re: psql question: aborting a "script"