Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id CA5B8B5DC0F for ; Thu, 8 Sep 2011 07:09:37 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 69975-04 for ; Thu, 8 Sep 2011 10:09:31 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mailout-de.gmx.net (mailout-de.gmx.net [213.165.64.23]) by mail.postgresql.org (Postfix) with SMTP id 0F9F9B5DC12 for ; Thu, 8 Sep 2011 07:09:30 -0300 (ADT) Received: (qmail invoked by alias); 08 Sep 2011 10:09:24 -0000 Received: from fsgw.f-secure.com (EHLO [10.128.133.18]) [193.110.108.33] by mail.gmx.net (mp011) with SMTP; 08 Sep 2011 12:09:24 +0200 X-Authenticated: #495269 X-Provags-ID: V01U2FsdGVkX1/mjAxLQ7fmUH1Ug0haynUpR2q/wZ8aaRukLuJUVc dLZR9lxKClVFqf Subject: Re: psql doesn't reuse -p after backend fail From: Peter Eisentraut To: depesz@depesz.com Cc: Tom Lane , pgsql-bugs@postgresql.org In-Reply-To: <20110906151253.GA1209@depesz.com> References: <20110905174633.GA7752@depesz.com> <11444.1315247243@sss.pgh.pa.us> <20110906151253.GA1209@depesz.com> Content-Type: text/plain; charset="UTF-8" Date: Thu, 08 Sep 2011 13:09:22 +0300 Message-ID: <1315476562.17143.0.camel@fsopti579.F-Secure.com> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.393 tagged_above=-5 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RP_MATCHES_RCVD=-0.504, T_TO_NO_BRKTS_FREEMAIL=0.01 X-Spam-Level: X-Archive-Number: 201109/57 X-Sequence-Number: 31074 On tis, 2011-09-06 at 17:12 +0200, hubert depesz lubaczewski wrote: > On Mon, Sep 05, 2011 at 02:27:23PM -0400, Tom Lane wrote: > > It's not just the port, it's all the connection parameters --- > > do_connect relies on the PGconn object to remember those, and in this > > case there no longer is a PGconn object. > > > > We could have psql keep that information separately, but I'm not sure > > it's really worth the trouble. > > well, I think it's definitely worth the trouble. If I had datbaase > standing at 5432, it would connect to it, and then I could mistakenly > ran commands to wrong database. > this is clearly not a good thing. Perhaps just prevent \connect without argument if the information is no longer available.