Michele Pradella wrote:
> I have a question about data type BIGINT

BIGINT is not a data type.

> from docs (http://www.sqlite.org/datatype3.html)

This page says the data types are NULL, INTEGER, REAL, TEXT, and BLOB.

> I understand that INTEGER and BIGINT results in the same affinity

Yes.

> so datatypes are same, is it correct?

No.  SQLite uses dynamic typing; the data type of a value is whatever
type was used when inserting this value (and as modified by the
affinity).

> if I create a table with a field "Id BIGINT PRIMARY KEY AUTOINCREMENT"
> I got the error "AUTOINCREMENT is only allowed on an INTEGER PRIMARY
> KEY"

The documentation <http://www.sqlite.org/lang_createtable.html#rowid>
says:
| A PRIMARY KEY column only becomes an integer primary key if the
| declared type name is exactly "INTEGER". Other integer type names like
| "INT" or "BIGINT" or "SHORT INTEGER" or "UNSIGNED INTEGER" causes the
| primary key column to behave as an ordinary table column with integer
| affinity and a unique index, not as an alias for the rowid.

> Is there a way to sue AUTOINCREMENT with BIGINT?

No.  Neither is there a way to use AUTOINCREMENT with BIGINT.

> what's the reason for this check?

Backwards compatibility.


Please note that with an INTEGER PRIMARY KEY column, it is likely that
you do not need AUTOINCREMENT: <http://www.sqlite.org/autoinc.html>.


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

Reply via email to