On Sunday, November 20, 2011 3:56:18 am Phoenix Kiula wrote:
> > Any ideas?
>
> Just to add, the connection string I try for pgbouncer is EXACTLY the
> same as the one I use to connect directly to PG, but I add the port
> number.
That may be the problem. The Postgres server and pgbouncer are not the same
thing. Visual aids:
Client --> pgbouncer --> Postgres server
Client credentials pgbouncer auth Postgres auth
auth file Pg pg_shadow
The authentication chain is
Client send credentials to pgbouncer.
pgbouncer checks against its list of approved users and method of
authentication.
If client passes that then pgbouncer tries to open connection to database
specified by client, using credentials listed in connection for that database in
the [databases] section of ini file.
If those credentials match those in Postgres server then a connection is
allowed.
There is nothing that says the users admitted by pgbouncer have to be the same
as those admitted by Postgres.
From what you reporting you are authenticating to pgbouncer and not to Postgres.
This was pointed out upstream by Marko. I would do a careful review of what
user you are connecting as, to each program. Also when posting the log results
please specify which program they are coming from, takes out the guess work:)
>
> For Direct PG (works) --
> pg_connect("host=localhost dbname=$db user=myuser password=mypass");
>
> For Pgbouncer (does NOT work) --
> pg_connect("host=localhost dbname=$db port=6432 user=myuser
> password=mypass");
>
> Given that both PG and postgresql are alive and kicking on 5432 and
> 6432 ports respectively, as shown in the netstat output above, I
> wonder if the connection string is the problem.
--
Adrian Klaver
adrian.klaver@gmail.com