diff --git a/horizon.dhall b/horizon.dhall
index 0314e3c760d575156accdccccbb20a5b77d8c413..70031a2d4e370c21059e3f497893bfeb917c155f 100644
--- a/horizon.dhall
+++ b/horizon.dhall
@@ -640,6 +640,7 @@ let packages =
       , polysemy-vinyl = H.callHackage "polysemy-vinyl" "0.1.5.0"
       , polysemy-zoo = H.callHackage "polysemy-zoo" "0.8.1.0"
       , port-utils = H.callHackage "port-utils" "0.2.1.0"
+      , postgresql-binary = H.callHackage "postgresql-binary" "0.13.1"
       , postgres-options = H.callHackage "postgres-options" "0.2.0.0"
       , postgresql-libpq = H.callHackage "postgresql-libpq" "0.9.5.0"
       , postgresql-migration = H.callHackage "postgresql-migration" "0.2.1.6"
diff --git a/horizon.lock b/horizon.lock
index c33043ca4ad15caca1b01a768e97338a42bc7629..5ac0871b62f17594c9e2689274c1ea4fd48e1582 100644
--- a/horizon.lock
+++ b/horizon.lock
@@ -2010,6 +2010,10 @@
   , mapValue =
       "6c933c650d29d124d42e6cf06de7452f448a50eaccc4e0fb6a71d8c443a61b9f"
   }
+, { mapKey = "postgresql-binary"
+  , mapValue =
+      "f72b466655600fefedbfc95b7d95359acf06fea0e6614d72e9d2d3294f25c67a"
+  }
 , { mapKey = "postgresql-libpq"
   , mapValue =
       "fb5b98161077394efc766528082c2b2d6b4c2314c3d4c62c4fe25aaf1de7a773"
diff --git a/overlay.nix b/overlay.nix
index 0f0e76ad9afab0825236f4bafa2a1d30945355af..3e9e2550cb414faccf8fc44abecfab9627a87f7c 100644
--- a/overlay.nix
+++ b/overlay.nix
@@ -1007,6 +1007,8 @@ final: prev: with pkgs.haskell.lib; {
 
   postgres-options = final.callPackage (./pkgs/postgres-options.nix) { };
 
+  postgresql-binary = final.callPackage (./pkgs/postgresql-binary.nix) { };
+
   postgresql-libpq = final.callPackage (./pkgs/postgresql-libpq.nix) { };
 
   postgresql-migration = final.callPackage (./pkgs/postgresql-migration.nix) { };
diff --git a/pkgs/postgresql-binary.nix b/pkgs/postgresql-binary.nix
new file mode 100644
index 0000000000000000000000000000000000000000..4b9344c0bce72dc28e7897ebcd57b8a023a6b88c
--- /dev/null
+++ b/pkgs/postgresql-binary.nix
@@ -0,0 +1,35 @@
+{ mkDerivation, QuickCheck, aeson, base, binary-parser, bytestring
+, bytestring-strict-builder, containers, criterion, lib, network-ip
+, postgresql-libpq, quickcheck-instances, rerebase, scientific
+, tasty, tasty-hunit, tasty-quickcheck, text, time, transformers
+, unordered-containers, uuid, vector
+}:
+mkDerivation {
+  pname = "postgresql-binary";
+  version = "0.13.1";
+  sha256 = "a2ce0f6302b9482835675f78b2051a95ffcc5c0d9e8c1b7ca670ea5ea5b61951";
+  isLibrary = true;
+  isExecutable = false;
+  enableSeparateDataOutput = false;
+  libraryHaskellDepends = [
+    aeson base binary-parser bytestring bytestring-strict-builder
+    containers network-ip scientific text time transformers
+    unordered-containers uuid vector
+  ];
+  testHaskellDepends = [
+    aeson network-ip postgresql-libpq QuickCheck quickcheck-instances
+    rerebase tasty tasty-hunit tasty-quickcheck
+  ];
+  benchmarkHaskellDepends = [ criterion rerebase ];
+  enableLibraryProfiling = true;
+  enableExecutableProfiling = true;
+  doHaddock = false;
+  jailbreak = true;
+  doCheck = false;
+  doBenchmark = false;
+  hyperlinkSource = false;
+  homepage = "https://github.com/nikita-volkov/postgresql-binary";
+  description = "Encoders and decoders for the PostgreSQL's binary format";
+  license = lib.licenses.mit;
+  broken = false;
+}
\ No newline at end of file