Committed by Greg Sabino Mullane <[email protected]>

Try to dequote bytea array, per bug 91454. Untested!

---
 dbdimp.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/dbdimp.c b/dbdimp.c
index 274ece5..e96daa4 100644
--- a/dbdimp.c
+++ b/dbdimp.c
@@ -2759,11 +2759,18 @@ static SV * pg_destringify_array(pTHX_ imp_dbh_t 
*imp_dbh, unsigned char * input
                                                av_push(currentav, newSViv('1' 
== *string ? 1 : 0));
                                }
                                else {
+                                       // Bytea gets special dequoting
+                                       if (0 == strncmp(coltype->type_name, 
"_bytea", 6)) {
+                                               coltype->dequote(string, 
&section_size);
+                                       }
+
                                        SV *sv = newSVpvn(string, section_size);
-                                       if (0 != strncmp(coltype->type_name, 
"_bytea", 6)
-                                               && imp_dbh->pg_utf8_flag) {
+
+                                       // Mark as utf8 if needed (but never 
bytea)
+                                       if (0 == strncmp(coltype->type_name, 
"_bytea", 6)
+                                               && imp_dbh->pg_utf8_flag)
                                                SvUTF8_on(sv);
-                                       }
+
                                        av_push(currentav, sv);
 
                                }
-- 
1.8.4

Reply via email to