reina_ga@hotmail.com (Tony Reina) writes:
> However, what about in the general case where my client program
> doesn't know if a password is required or not. Is there any libpq
> function to query the server if a password is required? Perhaps,
> there's a return value for PQconnectdb which would tell me that the
> connection failed because of the password? (In which case, I can ask
> for the password and try the connection again.)
Look into the psql source code; it does essentially this.
regards, tom lane