On 26/02/2009 8:23 PM, Marian Aldenhoevel wrote:
> Hi,
> 
> I am having a strange problem with a sqlite3 database. See the following 
> transcript:
> 
>  > sqlite3 kdb "select * from kfz where kfznr=48482364;"
>  > 48482364|48|0|0C|00|00|0||20|5B93|1746294314|||0|GP-T 1006|0
> 
> kfznr is the primary key, so this is to be expected. Now two queries as 
> fired from the application code:
> 
>  > sqlite3 kdb "select * from kfz where CRC32=-797785824;"
>  > 48482364|48|0|0C|00|00|0||20|5B93|-797785824|||0|GP-T 1006|0
>  > 20209001|20|1|3C|00|32|24999||13|CE42|-797785824|||0|FL-HH 11|1
>  > 20209001|20|1|3C|00|32|24999||13|CE42|-797785824|||0|FL-HH 11|1
> 
>  > kdb "select * from kfz where CRC32=-1509747892;"
>  > 48482364|48|0|0C|00|00|0||20|5B93|-1509747892|||0|GP-T 1006|0
>  > 20209667|20|1|3C|00|32|202880||99|4FBD|-1509747892|||0|FL-AK 98|1
>  > 20209667|20|1|3C|00|32|202880||99|4FBD|-1509747892|||0|FL-AK 98|1
> 
> What could cause 48482364 to show up in both results with a different 
> value for CRC32?

Another problem: the second and third results from each of query 2 and 
query 3 are identical; this should not be so because the first column is 
a primary key.

Note that kfznr is allegedly TEXT ... interesting question: is it 
possible to have two rows, one where typeof(kfznr) is text and the other 
is integer AND they are not considered equal for primary key purposes?

Try repeating all 3 queries with
   select rowid, typeof(kfznr), * from ...

> 
> The table is defined like this:
> 
>  > CREATE TABLE IF NOT EXISTS KFZ (

Is that as reported by the command-line sqlite3 executable program, or 
is it from some script that you hope is the one that was used to create 
the table?

>  >       kfznr TEXT PRIMARY KEY,
>  >       partnernr INTEGER,
>  >       sendtoTA INTEGER,                    
>  >       saeule TEXT,
>  >       berechtigung2 TEXT,
>  >       berechtigung TEXT,
>  >    a_km TEXT,
>  >    max_km TEXT,
>  >    kont TEXT,
>  >    pincode TEXT,
>  >    CRC32 INTEGER,
>  >    verweis BLOB,
>  >    handynummer TEXT,
>  >    sperrung TEXT,
>  >        kennzeichen TEXT,
>  >    kontingentierung INTEGER);
>  >
>  > CREATE INDEX IF NOT EXISTS IDX_KFZ_PARTNERNR ON KFZ (sendtoTA,partnernr);
>  > CREATE INDEX IF NOT EXISTS IDX_KFZ_CRC32 ON KFZ (CRC32);
>  > CREATE INDEX IF NOT EXISTS IDX_KFZ_VERWEIS ON KFZ (VERWEIS);
>  > CREATE INDEX IF NOT EXISTS IDX_KFZ_HANDYNUMMER ON KFZ (HANDYNUMMER);
> 
> Ciao, MM
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> 

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

Reply via email to