pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jiri Sadek <jiri.sadek@gmail.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: psql command line client behaviour
Date: Thu, 05 May 2011 11:16:23 -0400
Message-ID: <4016.1304608583@sss.pgh.pa.us> (raw)
In-Reply-To: <4DC26F32.70409@gmail.com>
References: <4DC26F32.70409@gmail.com>

Jiri Sadek <jiri.sadek@gmail.com> writes:
> I was told about behaviour of psql command line client that seems as bug 
> to me. When I am connected to server (cmdline client, interactive mode) 
> and server is restarted next query fails and client try to reconnect to 
> server. Problem arise when I send more queries (not speaking that this 
> may not be a good habit) at once - on first one client detects that 
> connection is lost and try to reconnect and then rest of queries are 
> executed (but not the first one).

The reason it does that is that ON_ERROR_STOP isn't set.  If you don't
want execution of a multi-command string to continue after an error,
you should set that variable.  It's not obvious to me that loss of
connection should be treated differently here from other reasons for a
command failure.

Example:

$ psql
psql (9.1beta1)
Type "help" for help.

regression=# select 1/0; select 2;
ERROR:  division by zero
 ?column? 
----------
        2
(1 row)

regression=# \set ON_ERROR_STOP 1
regression=# select 1/0; select 2;
ERROR:  division by zero
regression=# 

			regards, tom lane



view thread (2+ messages)

Message-ID: <4016.1304608583@sss.pgh.pa.us>
Permalink:  ../4016.1304608583@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/4016.1304608583@sss.pgh.pa.us

 · 

reply

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-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, jiri.sadek@gmail.com
  Subject: Re: psql command line client behaviour
  In-Reply-To: <4016.1304608583@sss.pgh.pa.us>
  References: <4DC26F32.70409@gmail.com> <4016.1304608583@sss.pgh.pa.us>

* 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