1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-35117 Improve error message on unexpected geometries for st_distance_sphere

When invoking st_distance_sphere with unexpected geometries, the error
message now given is:
  ERROR HY000: Internal error: Point or multipoint geometries expected
This commit fixes a few formatting issues in the affected function.
This commit is contained in:
Dave Gosselin
2024-12-18 12:02:10 -05:00
committed by Daniel Black
parent 3a1f9dfda9
commit fbb6b50499
5 changed files with 28 additions and 16 deletions

View File

@@ -422,7 +422,7 @@ SELECT ST_DISTANCE_SPHERE(1, 1, 3);
# Return NULL if radius is NULL
SELECT ST_DISTANCE_SPHERE(1, 1, NULL);
# Wrong geometry
--error ER_INTERNAL_ERROR
--error ER_GIS_UNSUPPORTED_ARGUMENT
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)')) as result;
--echo # Test Points and radius
@@ -430,9 +430,9 @@ SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(
# make bb x86 happy
SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-1 -1)'), ST_GEOMFROMTEXT('POINT(-2 -2)')), 10) as result;
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), 1) as result;
--error ER_INTERNAL_ERROR
--error ER_GIS_UNSUPPORTED_ARGUMENT
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), 0) as result;
--error ER_INTERNAL_ERROR
--error ER_GIS_UNSUPPORTED_ARGUMENT
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), -1) as result;
--echo # Test longitude/lattitude
# make bb x86 happy
@@ -456,7 +456,7 @@ SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_G
SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )')), 10) as result;
# make bb x86 happy
SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )'),1), 17) as result;
--error ER_INTERNAL_ERROR
--error ER_GIS_UNSUPPORTED_ARGUMENT
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )'),0) as result;
# Longitude out of range [-180,180]