diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml
index 56689ba8730ec106290ebf84d2e13d6e3553c4f7..b449c834a95b8a6be41a30653bdb28067b5c9d0c 100644
--- a/doc/src/sgml/libpq.sgml
+++ b/doc/src/sgml/libpq.sgml
@@ -1782,7 +1782,7 @@ postgresql://%2Fvar%2Flib%2Fpostgresql/dbname
       <term><literal>sslsni</literal><indexterm><primary>Server Name Indication</primary></indexterm></term>
       <listitem>
        <para>
-        By default, libpq sets the TLS extension <quote>Server Name
+        If set to 1 (default), libpq sets the TLS extension <quote>Server Name
         Indication</quote> (<acronym>SNI</acronym>) on SSL-enabled connections.
         By setting this parameter to 0, this is turned off.
        </para>
diff --git a/src/interfaces/libpq/fe-secure-openssl.c b/src/interfaces/libpq/fe-secure-openssl.c
index 67feaedc4e07b3fda8f8e8e52e28c4be67a88e5d..f2b5feccc77a9f4690f183134db236af191704e1 100644
--- a/src/interfaces/libpq/fe-secure-openssl.c
+++ b/src/interfaces/libpq/fe-secure-openssl.c
@@ -1087,7 +1087,7 @@ initialize_SSL(PGconn *conn)
 	 * Per RFC 6066, do not set it if the host is a literal IP address (IPv4
 	 * or IPv6).
 	 */
-	if (conn->sslsni && conn->sslsni[0])
+	if (conn->sslsni && conn->sslsni[0] == '1')
 	{
 		const char *host = conn->connhost[conn->whichhost].host;