diff --git a/src/interfaces/libpq/fe-secure.c b/src/interfaces/libpq/fe-secure.c
index c6963bed9480f9fb61afc70c6e91b7583f9e0bfb..a0607ae84d6d7b62bd9cb61be646150509b11956 100644
--- a/src/interfaces/libpq/fe-secure.c
+++ b/src/interfaces/libpq/fe-secure.c
@@ -1013,7 +1013,7 @@ initialize_SSL(PGconn *conn)
 		 * might or might not accept the connection.  Any other error,
 		 * however, is grounds for complaint.
 		 */
-		if (errno != ENOENT)
+		if (errno != ENOENT && errno != ENOTDIR)
 		{
 			printfPQExpBuffer(&conn->errorMessage,
 			   libpq_gettext("could not open certificate file \"%s\": %s\n"),