Failed to connect postgres server when port specified
Imported from http://bugzilla.roxen.com/bugzilla/show_bug.cgi?id=5821
Reported by Eiichiro ITANI, emu@ceres.dti.ne.jp
When postgresql server is running with different port, pike7.4 fail to connect server. I beleive it's because some typo in postgres.c code.
I checked with Postgres.so module with 'PGDEBUG' option defined. On dbhost, I'm running two postgresql instance, one for port 5432 and other for port 5433. And server listening on 5433 accept connection with those settings, but 5432 doesn't.
$ pike7.4
Pike v7.4 release 693 running Hilfe v3.5 (Incremental Pike Frontend)
> object s = Sql.Sql("postgres://testuser@dbhost:5433/test_db");
pgres_create().
f_create(host=dbhost, port=(null), db=test_db, user=testuser, pass=(null)).
set_error(fe_sendauth: no password supplied
).
Could not connect to database. Reason: "fe_sendauth: no password supplied
".
Sql.postgres: Sql.postgres()->create("dbhost","test_db","testuser","",5433)
/usr/local/pike/pike7.4/pike/7.4.693/lib/modules/Sql.pmod/postgres.pike:160: Sql.postgres()->create("dbhost:5433","test_db","testuser","CENSORED")
/usr/local/pike/pike7.4/pike/7.4.693/lib/modules/Sql.pmod/Sql.pike:232: Sql.Sql()->create("postgres://testuser@dbhost:5433/test_db","test_db","testuser","CENSORED",UNDEFINED)
pgres_destroy().
I checked postgres.c and wrote patch. Now I can connect to postgres on port 5433.
$ pike7.4
Pike v7.4 release 693 running Hilfe v3.5 (Incremental Pike Frontend)
> object s = Sql.Sql("postgres://neowww@dbhost:5433/neowing_db");
>
I know pike7.4 is obsolete already, but I need it for Roxen4.5 running. Could you check this?
I'll attach my patch later.