I have three questions about libpq. Is there a way to get TOO MANY CONNECTIONS error code from libpq immediately after calling PQconnect* () ? Or how to determine such error not parsing PQerrorMessage() ? It seams, that all of the error codes may be obtained by calling PQresultErrorField() ? But this function works only with results. So in what situations TOO MANY CONNECTIONS error may be thrown after successfully connection ? :) In case of dblink? The same situation with SQLSERVER REJECTED ESTABLISHMENT OF SQLCONNECTION what does this error means?