On Sat, Mar 11, 2006 at 12:15:08PM -0500, Tom Lane wrote: > "Markus Bertheau" <[EMAIL PROTECTED]> 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 [EMAIL PROTECTED] http://fetter.org/ phone: +1 415 235 3778 Remember to vote!
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);
---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org