psql -p 5433; create database test; \c test failing
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 terminate with 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
connections on 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
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
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
Import Notes
Reply to msg id not found: 684362e10603110236x1fc37289q@mail.gmail.com
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 imhoYou 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
"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
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!
Attachments:
fix_psql.difftext/plain; charset=us-asciiDownload
Index: src/bin/psql/command.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/psql/command.c,v
retrieving revision 1.164
diff -c -r1.164 command.c
*** src/bin/psql/command.c 5 Mar 2006 15:58:51 -0000 1.164
--- src/bin/psql/command.c 12 Mar 2006 01:55:09 -0000
***************
*** 247,271 ****
strcmp(opt2, "") == 0) ? "" : opt2,
!opt3q && (strcmp(opt3, "-") == 0 ||
strcmp(opt3, "") == 0) ? "" : opt3,
! NULL);
if (opt2)
/* gave username */
success = do_connect(!opt1q && (strcmp(opt1, "-") == 0 ||
strcmp(opt1, "") == 0) ? "" : opt1,
!opt2q && (strcmp(opt2, "-") == 0 ||
strcmp(opt2, "") == 0) ? "" : opt2,
! NULL,
! NULL);
else if (opt1)
/* gave database name */
success = do_connect(!opt1q && (strcmp(opt1, "-") == 0 ||
strcmp(opt1, "") == 0) ? "" : opt1,
"",
! NULL,
! NULL);
else
/* connect to default db as default user */
! success = do_connect(NULL, NULL, NULL, NULL);
free(opt1);
free(opt2);
--- 247,271 ----
strcmp(opt2, "") == 0) ? "" : opt2,
!opt3q && (strcmp(opt3, "-") == 0 ||
strcmp(opt3, "") == 0) ? "" : opt3,
! "");
if (opt2)
/* gave username */
success = do_connect(!opt1q && (strcmp(opt1, "-") == 0 ||
strcmp(opt1, "") == 0) ? "" : opt1,
!opt2q && (strcmp(opt2, "-") == 0 ||
strcmp(opt2, "") == 0) ? "" : opt2,
! "",
! "");
else if (opt1)
/* gave database name */
success = do_connect(!opt1q && (strcmp(opt1, "-") == 0 ||
strcmp(opt1, "") == 0) ? "" : opt1,
"",
! "",
! "");
else
/* connect to default db as default user */
! success = do_connect("", "", "", "");
free(opt1);
free(opt2);
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 3778Remember 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. +
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!