diff --git a/SOURCES/postgresql-9.2.24-handle-EAGAIN-on-socket-write.patch b/SOURCES/postgresql-9.2.24-handle-EAGAIN-on-socket-write.patch
new file mode 100644
index 0000000..f733aea
--- /dev/null
+++ b/SOURCES/postgresql-9.2.24-handle-EAGAIN-on-socket-write.patch
@@ -0,0 +1,26 @@
+From ab371f752536e88307b2c6867d6821ec1397525e Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Patrik=20Novotn=C3=BD?= <panovotn@redhat.com>
+Date: Fri, 24 Jan 2020 01:04:48 +0100
+Subject: [PATCH] Handle EAGAIN error on socket write
+
+    See BZ#1754816
+---
+ src/backend/libpq/be-secure.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/backend/libpq/be-secure.c b/src/backend/libpq/be-secure.c
+index f6d9bc50c7..5af1f15239 100644
+--- a/src/backend/libpq/be-secure.c
++++ b/src/backend/libpq/be-secure.c
+@@ -522,7 +522,7 @@ my_sock_write(BIO *h, const char *buf, int size)
+ 	BIO_clear_retry_flags(h);
+ 	if (res <= 0)
+ 	{
+-		if (errno == EINTR)
++		if (errno == EINTR || errno == EAGAIN)
+ 		{
+ 			BIO_set_retry_write(h);
+ 		}
+-- 
+2.24.1
+
diff --git a/SPECS/postgresql.spec b/SPECS/postgresql.spec
index 1c12079..a4de493 100644
--- a/SPECS/postgresql.spec
+++ b/SPECS/postgresql.spec
@@ -63,7 +63,7 @@ Summary: PostgreSQL client programs
 Name: postgresql
 %global majorversion 9.2
 Version: 9.2.24
-Release: 1%{?dist}
+Release: 2%{?dist}
 
 # The PostgreSQL license is very similar to other MIT licenses, but the OSI
 # recognizes it as an independent license, so we do as well.
@@ -135,6 +135,9 @@ Patch13: postgresql-9.2.4-upgrade-and-perm-problems.patch
 # Upstream commit: 243de06be96d6001d01f2ec7c4573aad8b657195
 Patch14: postgresql-CVE-2018-10915.patch
 
+# See BZ#1754816
+Patch15: postgresql-9.2.24-handle-EAGAIN-on-socket-write.patch
+
 BuildRequires: perl(ExtUtils::MakeMaker) glibc-devel bison flex gawk help2man
 BuildRequires: perl(ExtUtils::Embed), perl-devel
 BuildRequires: readline-devel zlib-devel
@@ -373,6 +376,7 @@ benchmarks.
 %patch8 -p1
 %patch13 -p1
 %patch14 -p1
+%patch15 -p1
 
 # We used to run autoconf here, but there's no longer any real need to,
 # since Postgres ships with a reasonably modern configure script.
@@ -1170,6 +1174,9 @@ fi
 %endif
 
 %changelog
+* Fri Jan 24 2020 Patrik Novotný <panovotn@redhat.com> - 9.2.24-2
+- Patch fixing BZ#1754816: handle EAGAIN error on socket write
+
 * Tue Aug 14 2018 Pavel Raiskup <praiskup@redhat.com> - 9.2.24-1
 - update to the latest 9.2 release
 - fix CVE-2018-10915