Find fails in hashed view but works in plain view or ordered view.

Thomas Mills Hinkle <[email protected]> Sun, 30 Oct 2005 23:05:16 -0500
Newsgroups gmane.comp.db.metakit
Message-ID <[email protected]>
I stumbled onto what I think is a buggy situation where find and
select are behaving differently. The following python code should
demonstrate relatively clearly:

>>> cview=storage.getas('category[id:I,category:S]')
>>> metakit.dump(cview)
 id  category
 --  --------
  2  Dessert
 --  --------
 Total: 1 rows
>>> cview.find(id=2)
0
>>> cview.select(id=2)[0].category
'Dessert'
>>> rhsh = storage.getas('__category_hash__[_H:I,_R:I]')
>>> cview_hashed = cview.hash(rhsh,1)
>>> cview_hashed.find(id=2)
-1
>>> cview_ordered = cview.ordered()
>>> cview_ordered.find(id=2)
0
>>> cview[cview_ordered.find(id=2)].category
'Dessert'
>>>

For now, I'm going to workaround by using ordered views instead of
hashed for this particular case, since I think that's what I ought to
have been using for unique numeric IDs anyway.

Nonetheless, I'm still completely puzzled by the behavior. Can anyone
explain what might be going on here?

Thanks,
Tom
_____________________________________________
Metakit mailing list  -  [email protected]
http://www.equi4.com/mailman/listinfo/metakit