ST_IsValid() terminates on invalid geometry with State XX000

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

ST_IsValid() terminates on invalid geometry with State XX000

Thomas Müller

Hello,

 

When importing Openstreetmap data in a Nominatim database on Ubuntu 14.04, Postgres 9.6, Postgis  2.3.2 there was a record with an invalid geometry. When doing

 

select place_id

from placex

where st_isvalid(geometry)=false

 

I expected to get a list with the ids of all invalid records. Instead the Statement terminates on hitting the invalid record with a  SQL state: XX000 + Explanation why the geometry is invalid (Sorry for not noting it).

To get the actual id of the record I had to manually binary search over the ids. Luckily there was only one defect.

Is this really by design (and no other way)? Just listing all records with invalid geometries seems to be a quite useful query.


Thanks in advance

Thomas Müller


_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ST_IsValid() terminates on invalid geometry with State XX000

Björn Harrtell
I would also expect a list of ids. I've never seen ST_IsValid fail like that so it might be a bug. It would be helpful if you can provide the geometry to reproduce this case.

/Björn

2017-03-06 12:21 GMT+01:00 Thomas Müller <[hidden email]>:

Hello,

 

When importing Openstreetmap data in a Nominatim database on Ubuntu 14.04, Postgres 9.6, Postgis  2.3.2 there was a record with an invalid geometry. When doing

 

select place_id

from placex

where st_isvalid(geometry)=false

 

I expected to get a list with the ids of all invalid records. Instead the Statement terminates on hitting the invalid record with a  SQL state: XX000 + Explanation why the geometry is invalid (Sorry for not noting it).

To get the actual id of the record I had to manually binary search over the ids. Luckily there was only one defect.

Is this really by design (and no other way)? Just listing all records with invalid geometries seems to be a quite useful query.


Thanks in advance

Thomas Müller


_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users


_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ST_IsValid() terminates on invalid geometry with State XX000

Sandro Santilli-3
ST_IsValid simply prints those "reasons to be invalid" as NOTICE messages
so the statement should *NOT* be interrupted.

What client are you using to send those queries to PostgreSQL ?
Can you reproduce the interruption ?

Note that you could use ST_IsValidDetail to have a more terse
output (and more detail, if needed).

--strk;


On Sat, Mar 11, 2017 at 10:43:36AM +0100, Björn Harrtell wrote:

> I would also expect a list of ids. I've never seen ST_IsValid fail like
> that so it might be a bug. It would be helpful if you can provide the
> geometry to reproduce this case.
>
> /Björn
>
> 2017-03-06 12:21 GMT+01:00 Thomas Müller <[hidden email]>:
>
> > Hello,
> >
> >
> >
> > When importing Openstreetmap data in a Nominatim database on Ubuntu 14.04,
> > Postgres 9.6, Postgis  2.3.2 there was a record with an invalid geometry.
> > When doing
> >
> >
> >
> > select place_id
> >
> > from placex
> >
> > where st_isvalid(geometry)=false
> >
> >
> >
> > I expected to get a list with the ids of all invalid records. Instead the
> > Statement terminates on hitting the invalid record with a  SQL state:
> > XX000 + Explanation why the geometry is invalid (Sorry for not noting it).
> >
> > To get the actual id of the record I had to manually binary search over
> > the ids. Luckily there was only one defect.
> >
> > Is this really by design (and no other way)? Just listing all records with
> > invalid geometries seems to be a quite useful query.
> >
> >
> > Thanks in advance
> > Thomas Müller
> >
> > _______________________________________________
> > postgis-users mailing list
> > [hidden email]
> > https://lists.osgeo.org/mailman/listinfo/postgis-users
> >
_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users
Loading...