[postgis-tickets] [PostGIS] #4661: ST_Distance(geography, geography) fails when schema name contains hyphen character

PostGIS trac at osgeo.org
Thu Apr 9 05:24:13 PDT 2020


#4661: ST_Distance(geography, geography) fails when schema name contains hyphen
character
------------------------+---------------------
 Reporter:  kunszabo67  |      Owner:  pramsey
     Type:  defect      |     Status:  new
 Priority:  medium      |  Milestone:
Component:  postgis     |    Version:  2.5.x
 Keywords:              |
------------------------+---------------------
 `ST_Distance(geography, geography)` fails with a SQL syntax error when the
 PostGIS extension is installed in a schema whose name must be quoted
 because it contains a hyphen charater.


 Reproduction:


 Install the extension in a schema that has a quoted name that includes a
 hyphen character:

 {{{
 SET search_path TO public;
 CREATE SCHEMA "schema-with-hyphen";
 CREATE EXTENSION postgis WITH SCHEMA "schema-with-hyphen";
 SET search_path TO public, "schema-with-hyphen";
 }}}


 The problem occurs in the `ST_Distance` function with `geography`
 parameters:

 {{{
 SELECT 'POINT (1 1)'::geography, 'POINT (1 2)'::geography;
 -- returns: POINT (1 1), POINT (1 2)

 SELECT ST_DISTANCE('POINT (1 1)'::geography, 'POINT (1 2)'::geography);
 -- SQL Error [42601]: ERROR: syntax error at or near "-"
 }}}


 The variant with `geometry` parameters works as expected:

 {{{
 SELECT 'POINT (1 1)'::geometry, 'POINT (1 2)'::geometry
 -- returns: POINT (1 1), POINT (1 2)

 SELECT ST_DISTANCE('POINT (1 1)'::geometry, 'POINT (1 2)'::geometry);
 -- returns 1
 }}}


 The problem seems to be present in versions 2.5.0 and later.

-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/4661>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list