[postgis-users] Super weird problem: ST_GeomFromText('POINT(-114.112534 50.895364)') works, ST_GeomFromText('POINT(-114.228869 51.152249)') fails -- why?

Paul Ramsey pramsey at opengeo.org
Tue Jul 3 12:27:38 PDT 2012


Yes, it's very important to know your version/platform.
Also, does this point crash the back-end when inserted into an empty
table, or only when inserted after the initial series of points. If
the latter, then the problem isn't the particular point, but how the
index is dealing with your particular *collection* of points, so it
will be useful to know what that collection is.
P.

On Mon, Jul 2, 2012 at 4:10 AM, René Fournier <m5 at renefournier.com> wrote:
> If I try to insert a row containing particular coordinate, the query fails
> and the DB connection is lost. (By comparison, hundreds of inserts of other
> coordinates work fine.) Here's a straight copy-and-paste comparison from
> psql:
>
>
> mydb=# INSERT INTO addresses ( account_id, territory_id, location ) VALUES (
> 1, 0, ST_GeomFromText('POINT(-114.112534 50.895364)') ) RETURNING id;
>  id
> -----
>  333
> (1 row)
>
> INSERT 0 1
> mydb=# INSERT INTO addresses ( account_id, territory_id, location ) VALUES (
> 1, 0, ST_GeomFromText('POINT(-114.228869 51.152249)') ) RETURNING id;
> The connection to the server was lost. Attempting reset: Failed.
> !>
>
> Here's the table definition:
>
>
> CREATE TABLE public.addresses
> (id serial NOT NULL,
> account_id int NOT NULL,
> territory_id int NOT NULL,
> location GEOGRAPHY(POINT,4326),
> PRIMARY KEY (id));
> CREATE INDEX location ON addresses USING GIST (location);
>
> Strange right? FWIW, the queries are being generated programmatically by a
> script, so the error is not caused by a typo, since hundreds of other
> inserts work. Also, I've done a little research, two interesting findings:
>
> 1. All the multiplied coordinate values (abs(lat)*abs(lng)) of the
> SUCCESSFUL inserts are LOWER than the coordinates of failed query.
>
> 2. If I create the table without the index on location, the failed inserts
> suddenly work. So it seems the problem lies with the PostGIS updating the
> Index -- maybe it doesn't like the size of the values of the larger
> coordinates?
>
> Anyway, if you have any ideas of what I can do to fix this, I would love to
> hear them. Thanks!
>
> ...Rene
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>



More information about the postgis-users mailing list