Re: psql: immediately exit after an error?

From: Mike G <mike(at)thegodshalls(dot)com>
To: David Garamond <lists(at)zara(dot)6(dot)isreserved(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: psql: immediately exit after an error?
Date: 2004-08-11 04:26:41
Message-ID: 20040811042641.GD19602@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I would think that depends upon how the sql in the file is coded. You can use the RAISE NOTICE / ERROR commands to abort a function's execution.

> Can psql be told to exit immediately after an error (especially when
> doing commands from a file, -f)? This is the default behaviour of the
> mysql client, except when we give it -f option ("force").
>
> The problem is, when restoring a dump, a failure at the some point might
> cause the subsequent commands to produce wrong results (e.g. I redefine
> a builtin function with a plruby function with different behaviour, but
> plruby failed to be installed due to wrong path. Thus the subsequent
> commands are executed using the builtin function which is not the
> expected one.) Furthermore, you can't check on psql exit code to see
> whether _any_ command was not successfully executed.
>
> Of course one should examine the full psql output after a restore
> anyway, and the option to exit immediately after an error can save time
> (especially for large dumps).
>
> --
> dave
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Amir Zicherman 2004-08-11 05:07:12 lock conflicting with another
Previous Message Scott Ribe 2004-08-11 04:03:33 Re: shared_buffers Question