[Pgpool-hackers] database doesnot exist error

Guillaume Lelarge guillaume at lelarge.info
Tue May 24 20:03:52 UTC 2011


Le 05/24/2011 08:44 PM, Asif Rehman a écrit :
>>
>> Which PostgreSQL release do you use? or did you drop the postgres database?
>>
> I am using 9.0 version, But I did drop postgres database.
> 

OK. That should be kind of a burden. Each PostgreSQL tool uses this
database to do admin task, unless you use the PGDATABASE environment
variable.

>> So I start looking into the pgpool codebase. where I found that there
>>> are at-least three functions that are using "postgres" as hardcoded
>> database
>>> name
>>>
>>> 1- check_postmaster_started
>>> 2- health_check
>>> 3- make_persistent_db_connection
>>
>> You probably mean establish_persistent_connection.
>>
> Yes. though make_persistent_db_connection is being called from one other
> location with hardcoded string("postgres" ).
>

Yes, you're right.

>> In the first two functions, if postgres is not found, "template1" is used,
>>>  But for #3 "postgres" is the only option. Do you think there is any harm
>> in
>>> using "template1" instead of "postgres"?
>>
>> There shouldn't be any harm to do so. Except you won't be able to create
>> database with the default template database (template1) while pgpool is
>> connected to the template1 database. But it connects to it every
>> health_check_period (or every 30 sec if health_check_period<=0).
>>
>> Anyway, this is probably something we should fix. You're not required to
>> have a postgres database.
>>
>> Hmmm, how about something like this... (just an idea)
> 
> retry:
> dbname="postgres";
> if (make_persistent_db_connection(dbname) == NULL) {
>   dbname="template1";
>   goto retry;
> }
> 

Don't like the "goto" thingie. Yeah, I know, we already use it in pgpool
source code.

Anyway, you have an infinite loop if you can't connect to postgres and
template1 databases.

> OR Is it a good idea to add a configuration parameter in pgpool.conf that
> user can specify for himself. OR is there any better solution for this.
> 

I would prefer not. There is already so much parameters in pgpool.conf.
But it seems to be the right solution right now.


-- 
Guillaume
 http://www.postgresql.fr
 http://dalibo.com


More information about the Pgpool-hackers mailing list