Opened 13 years ago

Closed 13 years ago

#1280 closed defect (fixed)

No geoms in table are within the table extent

Reported by: strk Owned by: pramsey
Priority: blocker Milestone: PostGIS 2.0.0
Component: postgis Version: master
Keywords: Cc:

Description

with ext as ( select st_extent(geom) as g from small_sample) select gid from small_sample, ext where geom && ext.g;

No hits from the above. The table contains 22 items. The table is here http://trac.osgeo.org/postgis/attachment/ticket/1274/small_sample.sql.gz

Change History (6)

comment:1 by strk, 13 years ago

Corollary:

SELECT count(*) from small_sample WHERE geom && st_envelope(geom);
0

None of the geometries in that table (22) overlap their envelope. Nice uh ?

comment:2 by strk, 13 years ago

Resolution: invalid
Status: newclosed

I can't reproduce this on a new database, so I must have had dragons in the one over which I've been upgrading postgis. Dunno if this is in turn related to #1282 will check that.

comment:3 by strk, 13 years ago

For the record: calling postgis_dropbbox() on both operand fixes it for me on the old database as well, so must have been a transient error in the bbox cache handling. Very very scary.

comment:4 by strk, 13 years ago

It's enough to dropbbox on the first operand:

 postgis_dropbbox(geom) && st_envelope(geom) -- true
                  geom  && st_envelope(geom) -- false

No idea how to figure out what's wrong with those caches (and how they entered the DB in the first place)

comment:5 by strk, 13 years ago

Resolution: invalid
Status: closedreopened

Here's a culprit: gserialized_datum_predicate_2d

        /* Must be able to build box for each argument (ie, not empty geometry)
           and overlap boxes to return true. */
        if ( (gserialized_datum_get_box2df_p(gs1, &b1) == LW_SUCCESS) &&
             (gserialized_datum_get_box2df_p(gs2, &b2) == LW_SUCCESS) &&
              predicate(&b1, &b2) )
        {
                POSTGIS_DEBUGF(3, "got boxes %s and %s", box2df_to_string(&b1), box2df_to_string(&b2));
                return LW_TRUE;
        }
        return LW_FALSE;

Meaning if gserialized_datum_get_box2df_p fails we return false ?! Is this what && is supposed to do ? Shouldn't it _compute_ the box if not available instead ? I'll actually re-open this as it's something that needs to be fixed.

comment:6 by strk, 13 years ago

Resolution: fixed
Status: reopenedclosed

But then again, no problem with a completely new import. It's just with this data I have:

NOTICE:  gserialized_datum_predicate_2d
NOTICE:  Copying box out of serialization (flags say we do have one)
NOTICE:  got box2df BOX2DF(inf 0, inf 1.40129846432e-45)

I'll just dropbbox/addbbox and be happy.

Note: See TracTickets for help on using tickets.