ST_Equals checks if the two geometries are topologically equivalent, so "occupy the same space".
The equals operator checks if the geometries are exactly the same.
Some practical examples of differences are that e.g.
- the order of coordinates can be different for ST_Equals, but they need be exactly the same for the equals operator.
- for a polygon, for ST_Equals it is OK that there are extra collinear points in the boundary, as this doesn't change the space occupied.
I'm not aware of cases where the equals operator will return True while ST_Equals doesn't.
Sample script (in python, but that doesn't matter) that shows that ST_Equals gives different results than the equals operator:
import geopandas as gpd
wkt1 = "POLYGON((0 5, 5 5, 5 0, 0 0, 0 5))"
wkt2 = "POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))"
wkt3 = "POLYGON((0 0, 0 5, 4 5, 5 5, 5 0, 0 0))"
sql = f"""
SELECT GeomFromText('{wkt1}') = GeomFromText('{wkt1}') AS same_operator
,ST_Equals(GeomFromText('{wkt1}'), GeomFromText('{wkt1}')) AS same_st_equals
,GeomFromText('{wkt1}') = GeomFromText('{wkt2}') AS pointorder_operator
,ST_Equals(GeomFromText('{wkt1}'), GeomFromText('{wkt2}')) AS pointorder_st_equals
,GeomFromText('{wkt1}') = GeomFromText('{wkt3}') AS extrapoint_operator
,ST_Equals(GeomFromText('{wkt1}'), GeomFromText('{wkt3}')) AS extrapoint_st_equals
""" # noqa: E501
print(gpd.read_file(":memory:", sql=sql, engine="pyogrio").transpose())
Result:
0
same_operator 1
same_st_equals 1
pointorder_operator 0
pointorder_st_equals 1
extrapoint_operator 0
extrapoint_st_equals 1