Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 605DC1337BEF for ; Thu, 5 May 2011 12:16:45 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 65815-06 for ; Thu, 5 May 2011 15:16:27 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id CE8501337BF1 for ; Thu, 5 May 2011 12:16:26 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p45FGOsw004017; Thu, 5 May 2011 11:16:24 -0400 (EDT) To: Jiri Sadek cc: pgsql-bugs@postgresql.org Subject: Re: psql command line client behaviour In-reply-to: <4DC26F32.70409@gmail.com> References: <4DC26F32.70409@gmail.com> Comments: In-reply-to Jiri Sadek message dated "Thu, 05 May 2011 11:34:42 +0200" Date: Thu, 05 May 2011 11:16:23 -0400 Message-ID: <4016.1304608583@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201105/24 X-Sequence-Number: 30163 Jiri Sadek 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