[postgis-users] error in geometry operations

Michael Fuhr mike at fuhr.org
Sun Aug 20 15:50:38 PDT 2006


On Sun, Aug 20, 2006 at 05:12:42PM -0500, P Kishor wrote:
> -- Executing query:
> SELECT  a.id, b.id
> FROM    a, b
> WHERE   a.the_geom && b.the_geom AND WITHIN(b.the_geom, a.the_geom)
> LIMIT 10
> 
> oh crap! row number -1 is out of range 0..-1

That looks like an error from libpq, the client-side C API.  What
client interface are you using?  Apparently the query returned zero
rows but the client software tried to fetch a row.

> additionally, for a query like above, what all indexes are advised? I
> have the_geom in both tables indexed using GiST, fwiw.

I think a join like that will need to do a sequential scan on one
of the tables.  How many rows are in each table?  What's the output
of "EXPLAIN ANALYZE SELECT ..."?  That'll run the query to completion;
if you'd rather not wait that long then please post the output of
"EXPLAIN SELECT ...".  If you haven't run ANALYZE on the tables
then I'd recommend doing so to update the planner's statistics.

-- 
Michael Fuhr



More information about the postgis-users mailing list