Re: [PATCH] pgpassfile connection option - Mailing list pgsql-hackers

From Fabien COELHO
Subject Re: [PATCH] pgpassfile connection option
Date
Msg-id alpine.DEB.2.20.1610271438460.32179@lancre
Whole thread Raw
In response to Re: [PATCH] pgpassfile connection option  (Julian Markwort <julian.markwort@uni-muenster.de>)
Responses Re: [PATCH] pgpassfile connection option
List pgsql-hackers
>> I would suggest that the struct gets the value (from option, environment or 
>> default) and is always used elsewhere. The getPgPassFilename function 
>> should disappear and PasswordFromFile should be simplified significantly. 
> I agree, however that's easier said than done because the "default" is only 
> constant by its definition, not by its location.
> There is no "default" location as the home directory depends not only on the 
> system but also on the user. Afaics we can't entirely get rid of a function 
> to get the location of the default .pgpass file.

Hmmm... I thought to put the default if not set from the connection option 
or the environment variable, say in connectOptions2(), just before getting 
the password if it is needed? That is ensure that the pgpassfile field is 
not NULL before calling PasswordFromFile, so that PasswordFromFile does 
not have to do anything and then the error message can rely on the 
pgpassfile field?

-- 
Fabien.



pgsql-hackers by date:

Previous
From: Kyotaro HORIGUCHI
Date:
Subject: Re: Radix tree for character conversion
Next
From: Michael Paquier
Date:
Subject: Re: [BUG] pg_basebackup from disconnected standby fails