[postgis-users] error in geometry operations

P Kishor punkish at eidesis.org
Sun Aug 20 16:23:15 PDT 2006


On 8/20/06, Michael Fuhr <mike at fuhr.org> wrote:
> 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.

Methinks you are correct. My query does seem to be returning zero rows
(which it should not be doing -- see my reply to Paul Ramsey's
questions). Wrt what client I am using -- well, this is the stock
pgAdmin tool that comes with the software... is that what you mean?

>
> > 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.

Ran that, returns 500+ rows of info. ANALYZEd both tables, so stats on
both seem to be up-to-date.

-- 
Puneet Kishor http://punkish.eidesis.org/
Nelson Inst. for Env. Studies, UW-Madison http://www.ies.wisc.edu/
Open Source Geospatial Foundation https://edu.osgeo.org/



More information about the postgis-users mailing list