[postgis-users] Re: Re bug with GIST indexes

Mark Cave-Ayland m.cave-ayland at webbased.co.uk
Mon Mar 24 08:49:54 PST 2003


Hi Dave,

> OK, I've had one more cunning idea: let's say we keep the 
> existing index using BOXes without a SRID but we rewrite the 
> indexes to use BOX2D (or BOX3D if you want 3D spatial 
> indexing). It looks as if it should be possible to extract 
> the pointer to the geometry from the GISTENTRY structure in 
> Decompress() implying that we could access the SRID from the 
> index routines. However, since R-Trees only store data in 
> leaf nodes, we only have to do this for leaf nodes; otherwise 
> we can blindly return a SRID of -1 which could help speed 
> some things up.
> 
> Then we create a cast from geometry to BOX2D and have a 
> single copy of the spatial operators in PostGIS that work on 
> the BOX2D type. This can check the SRID and throw an error if 
> it mismatches, plus it keeps it to one consistent routine for 
> one spatial operators. I have no idea how to access the 
> record information given a key from the GISTENTRY structure, 
> but I will try posting the problem to one of the pgsql lists 
> to see if anyone can come up with anything.

I've just had some replies back from the PostgreSQL mailing lists. It
looks as if the solution to the problem is to declare the index as
'islossy'. This means that when the index returns a number of tuples,
islossy forces them back through the original (non-indexed) operators
which should throw an error on a SRID mismatch, even though only the BOX
is stored in the index itself :)

You can pick up the thread at
http://archives.postgresql.org/pgsql-general/2003-03/msg01211.php if
you're not subscribed to the lists. What do you think?



Cheers,

Mark.


---

Mark Cave-Ayland
Webbased Ltd.
Tamar Science Park
Derriford
Plymouth
PL6 8BX
England

Tel: +44 (0)1752 764445
Fax: +44 (0)1752 764446


This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender. You
should not copy it or use it for any purpose nor disclose or distribute
its contents to any other person.





More information about the postgis-users mailing list