The defect
base_geoengine/geo_operators.py, get_geo_equal_sql builds its comparison value without a SRID:
compare_to = "ST_GeomFromText(%s)"
ST_GeomFromText without a SRID argument produces a geometry with SRID 0, while the column carries the field's SRID (3857 default, or whatever the field declares). PostGIS geometry equality between different SRIDs is never true, so a geo_equal domain always returns an empty set — silently, with no error.
Every other operator in the same file already passes the SRID — _get_postgis_comp_sql does:
return f"{op}({table}.{col}, ST_GeomFromText(%s, %s))" # value + srid
get_geo_equal_sql alone omits it.
Affected
Verified present on 16.0, 17.0, 18.0 (geo_operators.py line ~49-51 on each), and carried into the 19.0 migration in #465.
The fix (proven downstream)
Mirror _get_postgis_comp_sql's SRID handling:
def get_geo_equal_sql(self, table, col, value, params):
base = self.geo_field.entry_to_shape(value, same_type=False)
srid = self.geo_field.srid
params.append(base.wkt)
params.append(srid)
return f" {table}.{col} = ST_GeomFromText(%s, %s)"
We carry a vendored derivative of this module and shipped exactly this fix with a regression test (create a point, search [('geom', 'geo_equal', <same GeoJSON>)], expect the record back — fails empty before the fix, passes after). Happy to open a PR against any branch the maintainers prefer.
Found while porting the module's domain layer to Odoo 19, where a new test suite exercised each operator individually — the operator has no call sites in our production code, which is presumably why it went unnoticed; the first user to write a geo_equal domain gets silently empty results.
The defect
base_geoengine/geo_operators.py,get_geo_equal_sqlbuilds its comparison value without a SRID:ST_GeomFromTextwithout a SRID argument produces a geometry with SRID 0, while the column carries the field's SRID (3857 default, or whatever the field declares). PostGIS geometry equality between different SRIDs is never true, so ageo_equaldomain always returns an empty set — silently, with no error.Every other operator in the same file already passes the SRID —
_get_postgis_comp_sqldoes:get_geo_equal_sqlalone omits it.Affected
Verified present on
16.0,17.0,18.0(geo_operators.pyline ~49-51 on each), and carried into the19.0migration in #465.The fix (proven downstream)
Mirror
_get_postgis_comp_sql's SRID handling:We carry a vendored derivative of this module and shipped exactly this fix with a regression test (create a point, search
[('geom', 'geo_equal', <same GeoJSON>)], expect the record back — fails empty before the fix, passes after). Happy to open a PR against any branch the maintainers prefer.Found while porting the module's domain layer to Odoo 19, where a new test suite exercised each operator individually — the operator has no call sites in our production code, which is presumably why it went unnoticed; the first user to write a
geo_equaldomain gets silently empty results.