Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rtree creation SQL statement #518

Merged
merged 1 commit into from
May 19, 2020

Conversation

peterstace
Copy link
Contributor

The original statement fails in the case where some of the existing
geometries are empty. The error message is:

rtree constraint failed: rtree_Building_geom.(minx<=maxx)

This change modifies the statement so that it only attempts to populate
the rtree with non-empty (or NULL) geometries. This is consistent with
the rtree triggers.

The original statement fails in the case where some of the existing
geometries are empty. The error message is:

	rtree constraint failed: rtree_Building_geom.(minx<=maxx)

This change modifies the statement so that it only attempts to populate
the rtree with non-empty (or NULL) geometries. This is consistent with
the rtree triggers.
@jyutzler jyutzler added this to the 1.3.0 milestone May 19, 2020
@jyutzler jyutzler merged commit d8ee2e4 into opengeospatial:master May 19, 2020
@@ -88,7 +88,7 @@ Each newly created spatial index SHALL be populated using the following SQL stat
[source,sql]
----
INSERT OR REPLACE INTO rtree_<t>_<c>
SELECT <i>, st_minx(<c>), st_maxx(<c>), st_miny(<c>), st_maxy(<c>) FROM <t>;
SELECT <i>, st_minx(<c>), st_maxx(<c>), st_miny(<c>), st_maxy(<c>) FROM <t> WHERE <c> NOT NULL AND NOT ST_Empty(<c>);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jyutzler @peterstace ST_Empty should be ST_IsEmpty to match the RTree Extension SQL Function specification.
The case of the existing functions should probably be corrected as well: ST_MinX, ST_MaxX, ST_MinY, ST_MaxY

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants