Identity column maximum value in SQLite DBs

前端 未结 4 2317
太阳男子
太阳男子 2021-02-20 02:35

I have a purely academic question about SQLite databases.

I am using SQLite.net to use a database in my WinForm project, and as I was setting up a new table, I got to th

4条回答
  •  醉酒成梦
    2021-02-20 03:00

    The documentation at http://www.sqlite.org/autoinc.html indicates that the ROWID will try to find an unused value via randomization once it reached its maximum number.

    For AUTOINCREMENT it will fail with SQLITE_FULL on all attempts to insert into this table, once there was a maximum value in the table:

    If the table has previously held a row with the largest possible ROWID, then new INSERTs are not allowed and any attempt to insert a new row will fail with an SQLITE_FULL error.

    This is necessary, as the AUTOINCREMENT guarantees that the ID is monotonically increasing.

提交回复
热议问题