On Jan 9, 2009, at 9:43 PM, Martin.Engelschalk wrote:

> Hello list,
>
> I definied a collation and used it in the order by - clauses of  
> queries.
> In one query, sqlite calls the collation function, and in the other
> query, it does not (i checked by inserting a printf inside the  
> collation
> function).
> The queries differ only in the order by - clause.
>
> This query Works OK:
>
> select d1._recno,
>       d1._source_id,
>       d1._source_position,
>       d1._source_len,
>       d1._source_lfd,
>       d1._list_id,
>       d1._list_lfd,
>       d1._country,
>       coalesce(d2._skip,d1._skip) _skip ,
>       coalesce(d1._skip,d2._skip) _state_num ,
>       d2.f_mail2Group f_mail2Group,
>       d2.f_mail2Code f_mail2Code,
>       d2.f_mail2Stat f_mail2Stat,
>       d1.f_FirstName f_FirstName,
>       d1.f_LastName f_LastName,
>       d1.f_StreetLine f_StreetLine,
>       d1.f_Zip f_Zip,
>       d1.f_CityName f_CityName,
>       d2.f_Bewertung f_Bewertung,
>       d2.f_Dublettengruppennummer f_Dublettengruppennummer,
>       d2.f_Dublettentyp f_Dublettentyp
>  from data1 d1 left outer join data2 d2 on d2._recno = d1._recno
> order by 11 collate DQS_NUM_ASC, 13 collate DQS_NUM_ASC, 12 collate
> DQS_NUM_ASC
>
> If I change the oder by - clause to the following, the collation
> function ist not called, and the result list is sorted in the standard
> order.
>
> order by 20 collate DQS_NUM_ASC, 21 collate DQS_NUM_ASC, 19 collate
> DQS_NUM_ASC
>
> All fields of the table "data2 d2" are defined as type "integer"
> My version is 3.2.5.
>
> Does anyone have an idea? Might it be a good idea to upgrade to the
> newest version? I want do do this only if really necessary.

The collation function is only called for sorting (or comparing) text
values. Is it possible that the second set of columns are entirely
populated with numbers, blobs and nulls?


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to