[postgis-tickets] [PostGIS] #3131: KNN geography still gives ERROR: index returned tuples in wrong order

PostGIS trac at osgeo.org
Sun May 31 01:25:31 PDT 2015


#3131: KNN geography still gives  ERROR:  index returned tuples in wrong order
----------------------+---------------------------
  Reporter:  robe     |      Owner:  pramsey
      Type:  defect   |     Status:  reopened
  Priority:  blocker  |  Milestone:  PostGIS 2.2.0
 Component:  postgis  |    Version:  trunk
Resolution:           |   Keywords:
----------------------+---------------------------

Comment (by robe):

 Not sure this is helpful or not, but I traced where its failing in
 postgresql code (it's in the backend/executor/nodeIndexscan.c line 251)
 and revised to output what it's getting. The issue is that cmp variable is
 returning -1 (the dump of cmp is what I added to see why it's falling into
 that loop)


 {{{
                 if (scandesc->xs_recheckorderby)
                 {
                         econtext->ecxt_scantuple = slot;
                         ResetExprContext(econtext);
                         EvalOrderByExpressions(node, econtext);

                         /*
                          * Was the ORDER BY value returned by the index
 accurate?  The
                          * recheck flag means that the index can return
 inaccurate values,
                          * but then again, the value returned for any
 particular tuple
                          * could also be exactly correct.  Compare the
 value returned by
                          * the index with the recalculated value.  (If the
 value returned
                          * by the index happened to be exact right, we can
 often avoid
                          * pushing the tuple to the queue, just to pop it
 back out again.)
                          */
                         cmp = cmp_orderbyvals(node->iss_OrderByValues,
 node->iss_OrderByNulls,
 scandesc->xs_orderbyvals,
 scandesc->xs_orderbynulls,
                                                                   node);
                         if (cmp < 0)
                                 elog(ERROR, "index returned tuples in
 wrong order: the cmp is %d", cmp);
                         else if (cmp == 0)
                                 was_exact = true;
                         else
                                 was_exact = false;
                         lastfetched_vals = node->iss_OrderByValues;
                         lastfetched_nulls = node->iss_OrderByNulls;
                 }
                 else
                 {
                         was_exact = true;
                         lastfetched_vals = scandesc->xs_orderbyvals;
                         lastfetched_nulls = scandesc->xs_orderbynulls;
                 }
 }}}

 {{{
 ERROR:  index returned tuples in wrong order: the cmp is -1
 }}}

--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/3131#comment:13>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list