Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#14060 closed (fixed)

PostGISAdapter needs to properly cast input for comparisons on geography columns.

Reported by: jbronn Owned by: jbronn
Component: GIS Version: 1.2
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

When performing exact queries on geography columns, the input is not casted to the geography type, leading to an error:

DatabaseError: operator does not exist: geography ~= geometry
LINE 1: ... FROM "geogapp_city" WHERE "geogapp_city"."point" ~= ST_Geom...
                                                             ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.

Attached is an initial patch for a test case demonstrating the problem.

Attachments (2)

geography_exact_fail.diff (573 bytes) - added by jbronn 5 years ago.
14060.1.diff (3.3 KB) - added by jbronn 5 years ago.

Download all attachments as: .zip

Change History (8)

Changed 5 years ago by jbronn

comment:1 Changed 5 years ago by jbronn

  • Component changed from Uncategorized to GIS
  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to jbronn
  • Patch needs improvement unset
  • Status changed from new to assigned

comment:2 Changed 5 years ago by jbronn

  • Summary changed from `PostGISAdapter` needs to properly cast input for comparisons on geography columns. to PostGISAdapter needs to properly cast input for comparisons on geography columns.

Changed 5 years ago by jbronn

comment:3 Changed 5 years ago by jbronn

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [13757]) Fixed #14060 -- PostGIS never implemented the ~= operator for geography types, so removed support for it.

comment:4 Changed 5 years ago by jbronn

(In [13758]) [1.2.X] Fixed #14060 -- PostGIS never implemented the ~= operator for geography types, so removed support for it.

Backport of r13757 from trunk.

comment:5 Changed 5 years ago by jbronn

PostGIS will properly cast internally geography types (hence why && operator works). The root cause of the issue is that despite the documentation, the ~= operator was never implemented for geography types. I had a discussion with Paul Ramsey in #postgis about this issue, and he confirmed it was a "doc mistake" and "only && was implemented for geography."

comment:6 Changed 4 years ago by jacob

  • milestone 1.3 deleted

Milestone 1.3 deleted

Note: See TracTickets for help on using tickets.
Back to Top