]> granicus.if.org Git - postgis/commitdiff
pgsql2shp fix for "XInvalid endian flag value encountered" on PostgreSQL 9.2 (#1830)
authorPaul Ramsey <pramsey@cleverelephant.ca>
Sun, 20 May 2012 08:20:41 +0000 (08:20 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Sun, 20 May 2012 08:20:41 +0000 (08:20 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@9756 b70326c6-7e19-0410-871a-916f4a2858ee

loader/pgsql2shp-core.c

index 3ec92d53a85ed8227d7aa608fc82b7f5cc14ba2d..11a88a98b8dfd39179ebd313a7658c5b50002bc9 100644 (file)
@@ -1350,6 +1350,18 @@ ShpDumperConnectDatabase(SHPDUMPERSTATE *state)
 
        PQclear(res);
 
+       /* Set bytea_output format to escape, required for PgSQL 9.2+ (dfuhry) */
+       res = PQexec(state->conn, "SET bytea_output='escape'");
+       if (PQresultStatus(res) != PGRES_COMMAND_OK)
+       {
+               snprintf(state->message, SHPDUMPERMSGLEN, _("Error setting bytea_output to 'escape': %s"), PQresultErrorMessage(res));
+               PQclear(res);
+               free(connstring);
+               return SHPDUMPERERR;
+       }
+
+       PQclear(res);
+
        /* Find the OID for the geometry type */
        res = PQexec(state->conn, "SELECT oid FROM pg_type WHERE typname = 'geometry'");
        if (PQresultStatus(res) != PGRES_TUPLES_OK)