[Fdo-trac] [fdo-trac] #1024: Queries with coalesced geometries fails

FDO trac_fdo at osgeo.org
Mon Nov 2 03:47:21 PST 2026


#1024: Queries with coalesced geometries fails
-----------------------------------+----------------------
   Reporter:  jng                  |      Owner:  jng
       Type:  defect               |     Status:  assigned
   Priority:  major                |  Milestone:  4.2.0
  Component:  PostgreSQL Provider  |    Version:
   Severity:  3                    |   Keywords:
External ID:                       |
-----------------------------------+----------------------
 Copy from https://trac.osgeo.org/mapguide/ticket/2841

 The cause is at the PostgreSQL provider level.

 Root cause
 A PostGIS view that merges two geometry types (COALESCE(pt, ln) AS geom)
 loses its geometry typmod, so geometry_columns reports the column as srid
 0 / GEOMETRY even though every row still carries a real SRID:

 {{{
 f_table_name      f_geometry_column  srid   type
 v_ticket2841      geom                   0   GEOMETRY     <- COALESCE view
 v_ticket2841_lines geom               25832   LINESTRING   <- "l.line AS
 geom" view
 rows in v_ticket2841: ST_SRID(geom) = 25832 (POINT and LINESTRING)
 }}}

 The provider takes the spatial filter's SRID from that metadata and binds
 the filter geometry with it:

 FdoRdbmsPostGisFilterProcessor.cpp:199 starts at srid = -1 and fills it
 from geomCol->GetSRID() (:207), which is -1 when geometry_columns.srid is
 0 (ColumnGeom.cpp:84, fed by the geometry_columns query at
 SpatialContextReader.cpp:255).
 That SRID travels with the bind value (:271); Geometry.c:317 only sets the
 EWKB SRID flag when srid > 0, so the filter geometry arrives at the server
 as SRID 0.
 The generated SQL is ("geom" && $1::geometry AND
 _ST_Intersects("geom",$1::geometry)), and PostGIS rejects the exact
 predicate:

 {{{
 ERROR: ST_Intersects: Operation on mixed SRID geometries (Point, 25832) !=
 (Polygon, 0)
 }}}
-- 
Ticket URL: <https://trac.osgeo.org/fdo/ticket/1024>
FDO <http://fdo.osgeo.org/>
Feature Data Objects


More information about the fdo-trac mailing list