[postgis-users] SOLVED: Re: Invalid endian flag value encountered on Postgis 2.0.1, Postgres 9.x, Windows XP

Václav Řehák rehakv01 at gmail.com
Fri Oct 19 08:03:45 PDT 2012


For the record: the problem was caused by incorrect escaping of strings.
I solved it by setting standard_conforming_strings = off in postgresql.conf

There is also a ticket (solved) in Django:
https://code.djangoproject.com/ticket/16778

2012/10/19 Václav Řehák <rehakv01 at gmail.com>:
> Hi,
>
> I upgraded my development machine to Postgres 9.2 with Postgis 2.0.1
> installed by the stack builder on Windows XP 32bit. My Django
> application started to fail on a particular query which I nailed down
> to the following problem:
>
> select ST_GeomFromEWKB('\\001\\001\\000\\000
> \\263\\216\\001\\000\\000\\000\\000\\000\\252\\326''\\301\\000\\000\\000\\000X\\025.\\301'::bytea);
>
> ERROR: Invalid endian flag value encountered.
> SQL state: XX000
>
> The upgrade was performed by creating new db in PgAdmin using
> template_postgis_20 and restoring from a backup with
> postgis_restore.pl
>
> I kept my previous Postgis 1.5.3 in Postgres 8.4 running on a
> different port so I can test that the same WKB works there:
>
> select st_astext(ST_GeomFromEWKB('\\001\\001\\000\\000
> \\263\\216\\001\\000\\000\\000\\000\\000\\252\\326''\\301\\000\\000\\000\\000X\\025.\\301'::bytea))
>
> "POINT(-781141 -985772)"
>
> which is correct (in S-JTSK projection, SRID 102067).
>
> I also tried Postgres 9.1 with both Postgis 1.5.5 and 2.0.1 but I
> still get the endian error so I'm suspicious it has something to do
> with Postgres version rather than Postgis.
>
> Do you know how to check if the EWKB is correct? And what to check in
> my Postgres setup?
>
> Thanks.
>
> Vaclav



More information about the postgis-users mailing list