Missing results after adding index

Paul Ramsey pramsey at cleverelephant.ca
Mon Feb 24 10:53:52 PST 2025


Clearly the index test associated with that query is not consistent with the full calculation, so yeah, seems like a bug. 

> On Feb 24, 2025, at 10:41 AM, Kjell Kvinge <kjell at easyconnect.no> wrote:
> 
> Hi.
> 
> I notice different behaviour in postgis 3.5 compared to previous versions.
> 
> When I add an index to a table containing extents, the result from query disappears 
> 
> 
> Example to isolate this issue:
> 
> # starting docker image postgis/postgis:17-3.5
> 
> create temp table test (street text, extent geometry(Polygon,32633));
> insert into test values ('Knøsesmauet','0103000020797F0000010000000500000010B2468761BDDFC06390523AA1B0594110B2468761BDDFC030554D9BC3B0594107992AF50799DFC030554D9BC3B0594107992AF50799DFC06390523AA1B0594110B2468761BDDFC06390523AA1B05941');
> set enable_seqscan=false;
> SELECT street
> FROM test
> WHERE ST_DFullyWithin(
>     ST_SetSRID(ST_GeomFromText('POINT(-32356 6734606)'), 32633),
>     extent,
>     1700
> );
> 
> -- we get the street as expected.
> 
> -- we add an index
> create index ON test using gist (extent );
> 
> now, running the same query returns zero rows.
> 
> # starting docker image postgis/postgis:17-3.4
> Now, both queries returns expected street.
> 
> 
> Is this a bug I have stumbled upon? or am I missing something here?
> 
> Thank you.
> 
> br.
> Kjell Kvinge.
> 



More information about the postgis-users mailing list