Re: unexplainable psql exit status 1

From: Tim Kane <tim(dot)kane(at)gmail(dot)com>
To: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>, pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: Re: unexplainable psql exit status 1
Date: 2013-12-04 13:21:02
Message-ID: CEC4DCB0.4FE95%tim.kane@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


> According to the documentation you quoted, it would be useless to set
> log_statement=all, because the problem is on the client end.
>
> Shell debugging sounds slightly more promising, but it will probably
> not tell you much more than that psql returned with exit code 1.
>
> A quick look at the code gave me the impression that psql will always
> write an error message before exiting with 1, but I may have missed a case.
>
> Are you sure that there is nothing on stdout or stderr in the cases where
> psql returns 1?
>
> What is the last psql command that is executed?
>
> Yours,
> Laurenz Albe

Thanks Laurenz.
I’ve enabled shell debugging to be 100% sure that I’m not munging the return
code anywhere. It’s entirely possible there is something going on at the
shell side of things, though I fail to see how just at the minute :)
The output of the script is as follows, bearing in mind that all STDERR is
being redirected to STDOUT – there should be no other output to be found.
I’ve verified stdout just in case, to no avail.

\set QUIET 1
\timing
\set HISTSIZE 2000
\unset QUIET
DISCARD ALL;
DISCARD ALL
Time: 0.321 ms
—-SELECT STATEMENT SNIPPED
SELECT 7713
Time: 22.081 ms
CREATE TABLE IF NOT EXISTS duplicates(like source_table);
psql:/path/to/duplicate_removal.sql:36: NOTICE: relation "duplicates"
already exists, skipping
CREATE TABLE
Time: 0.416 ms
BEGIN;
BEGIN
Time: 0.210 ms
—-INSERT STATEMENT SNIPPED
INSERT 0 7713
Time: 93.855 ms

-—DELETE STATEMENT SNIPPED
DELETE 7713
Time: 33.939 ms

COMMIT;
COMMIT
Time: 0.242 ms

Cheers,

Tim

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2013-12-04 13:47:05 Re: unexplainable psql exit status 1
Previous Message Albe Laurenz 2013-12-04 12:48:09 Re: unexplainable psql exit status 1