Skip site navigation (1) Skip section navigation (2)

Re: Building Postgresql under Windows question

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Dann Corbit <DCorbit(at)connx(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Building Postgresql under Windows question
Date: 2009-04-28 21:27:18
Message-ID: 49F774B6.6070807@dunslane.net (view raw or flat)
Thread:
Lists: pgsql-hackers

Dann Corbit wrote:
> In this function:
> static bool
> test_postmaster_connection(bool do_checkpoint)
>
> This code will never succeed:
> 	snprintf(connstr, sizeof(connstr),
> 			 "dbname=postgres port=%s connect_timeout=5",
> portstr);
>
> 	for (i = 0; i < wait_seconds; i++)
> 	{
> 		if ((conn = PQconnectdb(connstr)) != NULL &&
> 			(PQstatus(conn) == CONNECTION_OK ||
> 			 PQconnectionNeedsPassword(conn)))
> 		{
> 			PQfinish(conn);
> 			success = true;
> 			break;
> 		}
>
>
> Because pg_hba.conf has this:
> # TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
>
> # IPv4 local connections:
> host    all         all         127.0.0.1/32          trust
> # IPv6 local connections:
> host    all         all         ::1/128               trust
>
> to allow connections from the local machine.
>
> (A password is not needed to connect, so the code always fails).
>
>   


Why won't

	PQstatus(conn) == CONNECTION_OK 

be true and thus the code will succeed without requiring a password?

cheers

andrew


In response to

Responses

pgsql-hackers by date

Next:From: Alvaro HerreraDate: 2009-04-28 21:38:40
Subject: docs: mention autovacuum when ANALYZE is recommended
Previous:From: Dann CorbitDate: 2009-04-28 20:32:11
Subject: Re: Building Postgresql under Windows question

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group