Quoting "D. Richard Hipp" <d...@hwaci.com>:

> It might be possible to get BIGINT PRIMARY KEY AUTOINCREMENT to work
> like INTEGER PRIMARY KEY AUTOINCREMENT.  Or perhaps it is not.  That
> is unclear.  Certainly it would be a rather substantial change - much,
> much larger than the little patch supplied on the ticket.
>
> My doubts about whether or not it will work derive from the fact that
> a BIGINT column can store strings and blobs in addition to integers.
> How do you AUTOINCREMENT a blob?
>

I'd like to jump in here as one of the authors of libdbi and its  
sqlite driver. I've followed this discussion with some amusement as it  
perfectly reflects the pain when attempting to fit SQLite into a  
database abstraction layer :-)

I doubt that allowing BIGINT to auto-increment is the proper solution  
of the underlying problem. I'd like to focus your attention again on  
the example of the OP:

sqlite>  CREATE TABLE test(id INTEGER PRIMARY KEY, int INTEGER, bigint  
BIGINT);
sqlite> PRAGMA table_info(test);
0|id|INTEGER|0||1
1|int|INTEGER|0||0
2|bigint|BIGINT|0||0

We've heard in this discussion repeatedly that all integers are  
created equal (as far as SQLite is concerned), and that applications  
using SQLite should keep track of the data types themselves if size  
matters. However, as Richard points out, INTEGER PRIMARY KEY is  
different from INTEGER and from anything else. All I need as an  
application (or abstraction layer FWIW) author therefore is that  
SQLite tells me that that particular column is different. However, the  
example above shows that SQLite hides the fact that the INTEGER  
PRIMARY KEY column is internally handled differently as it disguises  
it as an INTEGER. If there's a way to find out at runtime that a  
column has been defined as INTEGER PRIMARY KEY instead of as INTEGER,  
all is well and I'll be able to fix the sqlite driver accordingly.

regards,
Markus

-- 
Markus Hoenicka
markus.hoeni...@cats.de
(Spam-protected email: replace the quadrupeds with "mhoenicka")
http://www.mhoenicka.de

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

Reply via email to