From e4ed4b745acd95ae177a90d8dd1198d9502f075b Mon Sep 17 00:00:00 2001 From: Paul Ramsey Date: Sun, 20 May 2012 08:20:41 +0000 Subject: [PATCH] pgsql2shp fix for "XInvalid endian flag value encountered" on PostgreSQL 9.2 (#1830) git-svn-id: http://svn.osgeo.org/postgis/trunk@9756 b70326c6-7e19-0410-871a-916f4a2858ee --- loader/pgsql2shp-core.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/loader/pgsql2shp-core.c b/loader/pgsql2shp-core.c index 3ec92d53a..11a88a98b 100644 --- a/loader/pgsql2shp-core.c +++ b/loader/pgsql2shp-core.c @@ -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) -- 2.40.0