Thread: psql -p 5433; create database test; \c test failing

psql -p 5433; create database test; \c test failing

From
"Markus Bertheau"
Date:
Hi,

this is from HEAD of a few days ago, it looks suspicious to me.
8.2devel runs on port 5433.

markus@katerina2:~/pgsql$ bin/psql -p 5433 template1 markus
Welcome to psql 8.2devel, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms     \h for help with SQL commands     \? for help with psql commands     \g or
terminatewith semicolon to execute query     \q to quit 

template1=# create database test;
CREATE DATABASE
template1=# \c test
could not connect to server: No such file or directory      Is the server running locally and accepting
connectionson Unix domain socket "/tmp/.s.PGSQL.5432"? 
Previous connection kept

Why is it trying to use 5432? Am I missing something? Is that the
expected behaviour?

Michael Fuhr hinted that
http://archives.postgresql.org/pgsql-committers/2006-02/msg00139.php
may be the cause of that.

Markus Bertheau


Re: psql -p 5433; create database test; \c test failing

From
Michael Glaesemann
Date:
On Mar 11, 2006, at 19:13 , Markus Bertheau wrote:

> Why is it trying to use 5432? Am I missing something? Is that the
> expected behaviour?

Was your 8.2devel install built with the default port of 5432? (i.e.,  
do you need to set the port to 5433 in postgresql.conf or at server  
start? It looks that way, as you're specifying the port with your  
psql connection.)

If so, it might be picking it up from there. It should probably try  
to connect to the same port as it's running, but it might not be  
looking in the right place for that. I'm not familiar with the code,  
but it doesn't look like it specifies the port if a port is not  
given, and I believe if no port is given, it'd just be like using  
psql to connect to the database that's not running on it's default port.

Michael Glaesemann
grzm myrealbox com





Re: psql -p 5433; create database test; \c test failing

From
Michael Glaesemann
Date:
On Mar 11, 2006, at 19:36 , Markus Bertheau wrote:

> I'm pretty sure you didn't have to specify the port with \c again in
> earlier versions - so this is a regression, and a confusing one imho

You couldn't connect to another host from the same psql session, so  
including the port wasn't even an option. I agree that it's  
unexpected. Do you want to try to fix it?

Michael Glaesemann
grzm myrealbox com





Re: psql -p 5433; create database test; \c test failing

From
Robert Treat
Date:
On Saturday 11 March 2006 05:51, Michael Glaesemann wrote:
> On Mar 11, 2006, at 19:36 , Markus Bertheau wrote:
> > I'm pretty sure you didn't have to specify the port with \c again in
> > earlier versions - so this is a regression, and a confusing one imho
>
> You couldn't connect to another host from the same psql session, so
> including the port wasn't even an option. I agree that it's
> unexpected. Do you want to try to fix it?
>

in earlier versions it bombed completly :-)
http://archives.postgresql.org/pgsql-bugs/2004-10/msg00306.php 

-- 
Robert Treat
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL


Re: psql -p 5433; create database test; \c test failing

From
Tom Lane
Date:
"Markus Bertheau" <mbertheau.pg@googlemail.com> writes:
> Why is it trying to use 5432? Am I missing something? Is that the
> expected behaviour?

> Michael Fuhr hinted that
> http://archives.postgresql.org/pgsql-committers/2006-02/msg00139.php
> may be the cause of that.

Confirmed here: \c drops the previous port connection setting (and the
host too according to my testing).  This is clearly a bug --- at least,
there was no hint in the patch description that it would change the
behavior of previously-accepted cases, and it would have had to
withstand much more careful review if that were stated to be the case.
        regards, tom lane


Re: psql -p 5433; create database test; \c test failing

From
David Fetter
Date:
On Sat, Mar 11, 2006 at 12:15:08PM -0500, Tom Lane wrote:
> "Markus Bertheau" <mbertheau.pg@googlemail.com> writes:
> > Why is it trying to use 5432? Am I missing something? Is that the
> > expected behaviour?
>
> > Michael Fuhr hinted that
> > http://archives.postgresql.org/pgsql-committers/2006-02/msg00139.php
> > may be the cause of that.
>
> Confirmed here: \c drops the previous port connection setting (and
> the host too according to my testing).  This is clearly a bug --- at
> least, there was no hint in the patch description that it would
> change the behavior of previously-accepted cases, and it would have
> had to withstand much more careful review if that were stated to be
> the case.

I believe that this patch fixes the problem.  Should there be
something in the regression tests for this?

Cheers,
D
--
David Fetter david@fetter.org http://fetter.org/
phone: +1 415 235 3778

Remember to vote!

Attachment

Re: psql -p 5433; create database test; \c test failing

From
Bruce Momjian
Date:
The patch wasn't ignored.  It is just that I never got to applying it yet.

---------------------------------------------------------------------------

David Fetter wrote:
> On Sat, Mar 11, 2006 at 12:15:08PM -0500, Tom Lane wrote:
> > "Markus Bertheau" <mbertheau.pg@googlemail.com> writes:
> > > Why is it trying to use 5432? Am I missing something? Is that the
> > > expected behaviour?
> > 
> > > Michael Fuhr hinted that
> > > http://archives.postgresql.org/pgsql-committers/2006-02/msg00139.php
> > > may be the cause of that.
> > 
> > Confirmed here: \c drops the previous port connection setting (and
> > the host too according to my testing).  This is clearly a bug --- at
> > least, there was no hint in the patch description that it would
> > change the behavior of previously-accepted cases, and it would have
> > had to withstand much more careful review if that were stated to be
> > the case.
> 
> I believe that this patch fixes the problem.  Should there be
> something in the regression tests for this?
> 
> Cheers,
> D
> -- 
> David Fetter david@fetter.org http://fetter.org/
> phone: +1 415 235 3778
> 
> Remember to vote!

[ Attachment, skipping... ]

--  Bruce Momjian   http://candle.pha.pa.us EnterpriseDB    http://www.enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +


Re: psql -p 5433; create database test; \c test failing

From
David Fetter
Date:
On Mon, Apr 10, 2006 at 10:02:25PM -0400, Bruce Momjian wrote:
> 
> The patch wasn't ignored.  It is just that I never got to applying it yet.

Neil's patch vs. psql supercedes this :)

Cheers,
D
-- 
David Fetter <david@fetter.org> http://fetter.org/
phone: +1 415 235 3778        AIM: dfetter666                             Skype: davidfetter

Remember to vote!