From 8d215637c5775ed0c238f4c15dbcc012ea27d90a Mon Sep 17 00:00:00 2001
From: "Stephen R. van den Berg" <srb@cuci.nl>
Date: Thu, 11 Sep 2014 09:12:15 +0200
Subject: [PATCH] Improve glue with libpq.

---
 CHANGES                         | 5 ++++-
 src/modules/Postgres/pgresult.c | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/CHANGES b/CHANGES
index a29365c465..745e98a369 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1266,8 +1266,11 @@ o foreach( arr[-two()..], string x), where two() returns 2 will no
   longer iterate over the first element in the array three times or
   crash.
 
+o Postgres.postgres_result now properly decodes binary blobs and
+  strips trailing spaces from CHAR columns.
+
 o Fixed a typo from 2001-05-05 that caused a lot of countries to
-  recide on the continent ',Europa' instead of "Europa" in
+  reside on the continent ',Europa' instead of "Europa" in
   Geography.Countries.
 
   Obviously the continent is not that often checked.
diff --git a/src/modules/Postgres/pgresult.c b/src/modules/Postgres/pgresult.c
index 74c1ef646e..d1374d5b51 100644
--- a/src/modules/Postgres/pgresult.c
+++ b/src/modules/Postgres/pgresult.c
@@ -115,7 +115,10 @@ extern PIKE_MUTEX_T pike_postgres_mutex;
 
 #include "pg_types.h"
 
-
+#ifndef BYTEAOID
+#define BYTEAOID        17
+#define BPCHAROID       1042
+#endif
 
 #define THIS ((struct postgres_result_object_data *) Pike_fp->current_storage)
 
-- 
GitLab