In the file where.c, near the bottom of the function 
isSortingIndex there is a line:

if( j>=nTerm || (i>=pIdx->nColumn && pIdx->onError!=OE_None) ){

Comment out the second part of the expression as follows:

if( j>=nTerm /* || (i>=pIdx->nColumn && pIdx->onError!=OE_None) */){

At the moment I'm thinking that second part should just be 
removed, but I'm not completely sure - maybe it should be replaced
with something else. At any rate it's just an optimization, so it
is safe to comment it out.



--- mike cariotoglou <[EMAIL PROTECTED]> wrote:

> I have found a bug in the way sqlite treats ORDER BY clauses.
> to reproduce the bug, run this script against an empty database (memory db
> would do):
> 
>   ===========================================
>   CREATE TABLE Eidh (
>     ekey VARCHAR(12) NOT NULL,
>     perigrafh VARCHAR(30) NOT NULL,
>     PRIMARY KEY(ekey));
> 
> 
>   INSERT INTO Eidh VALUES('0001','bla');
> 
>   CREATE TABLE KinApo (
>     ekey VARCHAR(12) NOT NULL ,
>     date DATE,
>     polhths INTEGER);
> 
>   INSERT INTO KinApo VALUES('0001',38353,40);
>   INSERT INTO KinApo VALUES('0001',38353,30);
>   INSERT INTO KinApo VALUES('0001',38353,20);
> 
>   select kinapo.ekey, kinapo.polhths
>   from eidh inner join kinapo on eidh.ekey=kinapo.ekey
>   order by eidh.ekey, kinapo.polhths
>   ==============================================
> 
> versin 3.2.2 of sqlite gives the following result set, which is unordered:
> 
>   0001 40
>   0001 30
>   0001 20
> 
> also, EXPLAIN shows that no sorting is taking place.
> 
> This is a SERIOUS malfunction!
> can you pls verify this in other environments (I am using dll 3.2.2, locally
> compiled),
> and do something about it.
> 
> 
> 
> 



        
                
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - You care about security. So do we. 
http://promotions.yahoo.com/new_mail

Reply via email to