different results for ST_Relate with 3 parameters compared to those for ST_Relate with 2 parameters

Paul Ramsey pramsey at cleverelephant.ca
Wed Oct 15 13:03:33 PDT 2025


On Wed, Oct 15, 2025 at 12:53 PM Antonio Valanzano <anvalanz at gmail.com>
wrote:

> Hi Paul
> I have upgraded to PosGIS 3.5.3 and GEOS  3.13.1 as you can see from the
> following output
>
> "postgis_full_version"
> "POSTGIS=""3.5.3 3.5.3"" [EXTENSION] PGSQL=""170""
> GEOS=""3.13.1-CAPI-1.19.2"" PROJ=""8.2.1 NETWORK_ENABLED=OFF URL_ENDPOINT=
> https://cdn.proj.org
> USER_WRITABLE_DIRECTORY=C:\Windows\ServiceProfiles\NetworkService\AppData\Local/proj
> DATABASE_PATH=C:\Program
> Files\PostgreSQL\17\share\contrib\postgis-3.5\proj\proj.db"" (compiled
> against PROJ 8.2.1) LIBXML=""2.12.5"" LIBJSON=""0.12""
> LIBPROTOBUF=""1.2.1"" WAGYU=""0.5.0 (Internal)"" (core procs from ""3.5.2
> 3.5.2"" need upgrade)"
>
> but the results are the same with one row for a query and 2 rows for the
> other query.
>
> Is this a known bug or no other user has already reported this behaviour ?
>

Not reported, and I'm afraid not solvable unless you can figure out the
specific thing about your install vs mine that is giving you a different
answer. (Windows is one possibility, though not one I particularly like,
platform differences are incredibly hard to isolate.)

Seeing if the problem is ordering based and number of entries based might
be interesting.

DELETE FROM docsk;
INSERT INTO docks ( geom, good )
  VALUES
        ('LINESTRING (170 290, 205 272)',true),
        ('LINESTRING (120 215, 176 197)',true),
        ('LINESTRING (290 260, 340 250)',false),
        ('LINESTRING (350 300, 400 320)',false),
        ('LINESTRING (370 230, 420 240)',false),
        ('LINESTRING (170 290, 205 272)',true),
        ('LINESTRING (120 215, 176 197)',true),
        ('LINESTRING (370 180, 390 160)',false);

P


> Antonio
>
>
>
>
> Il giorno mer 15 ott 2025 alle ore 20:59 Paul Ramsey <
> pramsey at cleverelephant.ca> ha scritto:
>
>> Sorry, I still cannot replicate. My 3.5 build still returns both results.
>> Maybe update to PostGIS 3.5.4 and GEOS 3.13.1 ?
>> P.
>>
>> On Wed, Oct 15, 2025 at 11:25 AM Antonio Valanzano <anvalanz at gmail.com>
>> wrote:
>>
>>> Here is the details of my installation:
>>>
>>> "postgis_full_version"
>>> "POSTGIS=""3.5.2 3.5.2"" [EXTENSION] PGSQL=""170""
>>> GEOS=""3.13.0-CAPI-1.19.0"" PROJ=""8.2.1 NETWORK_ENABLED=OFF URL_ENDPOINT=
>>> https://cdn.proj.org
>>> USER_WRITABLE_DIRECTORY=C:\Windows\ServiceProfiles\NetworkService\AppData\Local/proj
>>> DATABASE_PATH=C:\Program
>>> Files\PostgreSQL\17\share\contrib\postgis-3.5\proj\proj.db"" (compiled
>>> against PROJ 8.2.1) LIBXML=""2.12.5"" LIBJSON=""0.12""
>>> LIBPROTOBUF=""1.2.1"" WAGYU=""0.5.0 (Internal)"""
>>>
>>> Antonio
>>>
>>>
>>>
>>> Il giorno mer 15 ott 2025 alle ore 19:28 Paul Ramsey <
>>> pramsey at cleverelephant.ca> ha scritto:
>>>
>>>> Maybe you have found an old bug? Running exactly the same SQL as you, I
>>>> get two rows from each query.
>>>>
>>>> postgis=# SELECT
>>>>
>>>>                 d.id,
>>>>
>>>>                                ST_Relate(d.geom, l.geom) as patternMatrix
>>>>
>>>>                                       FROM docks as d, lakes as l
>>>>
>>>>                                                WHERE ST_Relate(d.geom,
>>>> l.geom, '1FF00F212');
>>>>  id | patternmatrix
>>>> ----+---------------
>>>>   1 | 1FF00F212
>>>>   2 | 1FF00F212
>>>> (2 rows)
>>>>
>>>> postgis=# SELECT
>>>> postgis-#   d.id,
>>>> postgis-#   ST_Relate(d.geom, l.geom) as patternMatrix
>>>> postgis-# FROM docks as d, lakes as l
>>>> postgis-# WHERE ST_Relate(d.geom, l.geom) = '1FF00F212';
>>>>  id | patternmatrix
>>>> ----+---------------
>>>>   1 | 1FF00F212
>>>>   2 | 1FF00F212
>>>> (2 rows)
>>>>
>>>> postgis=#
>>>> postgis=# select postgis_full_version();
>>>>
>>>>
>>>>
>>>>   postgis_full_version
>>>>
>>>>
>>>>
>>>>
>>>> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>>>>  POSTGIS="3.7.0dev 3.6.0rc2-134-g5dc95f1bc" [EXTENSION] PGSQL="180"
>>>> GEOS="3.15.0dev-CAPI-1.21.0" PROJ="9.6.2 NETWORK_ENABLED=ON URL_ENDPOINT=
>>>> https://cdn.proj.org
>>>> USER_WRITABLE_DIRECTORY=/Users/pramsey/Library/Application Support/proj
>>>> DATABASE_PATH=/opt/homebrew/Cellar/proj/9.6.2/share/proj/proj.db" (compiled
>>>> against PROJ 9.6.2) LIBXML="2.9.13" LIBJSON="0.18" LIBPROTOBUF="1.5.2"
>>>> WAGYU="0.5.0 (Internal)" (core procs from "3.7.0dev
>>>> 3.6.0rc2-125-g747d7732b" need upgrade)
>>>>
>>>> On Wed, Oct 15, 2025 at 9:22 AM Antonio Valanzano <anvalanz at gmail.com>
>>>> wrote:
>>>>
>>>>> I am following the "Introduction to PostGIS " tutorial  at
>>>>> https://postgis.net/workshops/postgis-intro/
>>>>> and for chapter 26 "Dimensionally Extended 9-Intersection Model"  I
>>>>> am trying to replicate the examples.
>>>>>
>>>>> If I use the two different versions of ST_Relate I do not obtain the
>>>>> same result
>>>>>
>>>>> SELECT
>>>>>   d.id,
>>>>>   ST_Relate(d.geom, l.geom) as patternMatrix
>>>>> FROM docks as d, lakes as l
>>>>> WHERE ST_Relate(d.geom, l.geom, '1FF00F212') = true;
>>>>> -- 1 row
>>>>> "id" "patternmatrix"
>>>>> 1    "1FF00F212"
>>>>>
>>>>>
>>>>>
>>>>> SELECT
>>>>>   d.id,
>>>>>   ST_Relate(d.geom, l.geom) as patternMatrix
>>>>> FROM docks as d, lakes as l
>>>>> WHERE ST_Relate(d.geom, l.geom) = '1FF00F212';
>>>>> -- 2 rows
>>>>> "id" "patternmatrix"
>>>>> 1    "1FF00F212"
>>>>> 2    "1FF00F212"
>>>>>
>>>>> Could someone give me an explanation of such a difference ?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20251015/c55aa8be/attachment.htm>


More information about the postgis-users mailing list