diff --git a/src/backend/libpq/hba.c b/src/backend/libpq/hba.c
index 702971a..3482627 100644
*** a/src/backend/libpq/hba.c
--- b/src/backend/libpq/hba.c
*************** check_ip(SockAddr *raddr, struct sockadd
*** 530,538 ****
  			 raddr->addr.ss_family == AF_INET6)
  	{
  		/*
! 		 * Wrong address family.  We allow only one case: if the file
! 		 * has IPv4 and the port is IPv6, promote the file address to
! 		 * IPv6 and try to match that way.
  		 */
  		struct sockaddr_storage addrcopy,
  					maskcopy;
--- 530,538 ----
  			 raddr->addr.ss_family == AF_INET6)
  	{
  		/*
! 		 * If we're listening on IPv6 but the file specifies an IPv4 address to
! 		 * match against, we promote the latter also to an IPv6 address before
! 		 * trying to match the client's address.
  		 */
  		struct sockaddr_storage addrcopy,
  					maskcopy;
