Code

Opened 4 years ago

Closed 4 years ago

Last modified 3 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 4 years ago.
14060.1.diff (3.3 KB) - added by jbronn 4 years ago.

Download all attachments as: .zip

Change History (8)

Changed 4 years ago by jbronn

comment:1 Changed 4 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 4 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 4 years ago by jbronn

comment:3 Changed 4 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 4 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 4 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 3 years ago by jacob

  • milestone 1.3 deleted

Milestone 1.3 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.