1

For some reason in searching for data types the SQLite 2 documentation SQLite 2 documentation on typlessness came up and I read up on typlessness. I later came to realize that version 2's last release was in 2004. I then searched for version's 3 documentation SQLite 3 documentation and realized that the word 'typeless' does not show up however it appears that the feature was maintained in version 3. Is there a switch in terminology now from 'typelessness' to 'dynamic typing'?

Also, I tried changing the primary key [version 2's documentation says I can't] in a test database and I was able to change it.

Table schema Changing primary key

Is SQLite 3 then not typeless and can the primary key be changed in SQLite3?


EDIT: Thanks to Varro, I tried the following and was able to see that I can't put in a string as an id. I also tried inserting an extra row and the id automatically added was 11 and not 2 even though the numbering began at 1 but was changed to 10. So it seems that SQLite checks the previous integer before choosing what to the next row should be numbered.

Trying string for id PRIMARY KEY

heretoinfinity
  • 1,528
  • 3
  • 14
  • 33

1 Answers1

1

In general (barring explicit constraints), you can insert a value of any type into any column in SQLite, but a notable exception is if you declare a column INTEGER PRIMARY KEY, which means that it's an alias for the internal (integer) rowid. Notice that you changed the value but not the type of the primary key in your sample above. That's legal (provided the new value is unique), but changing it to e.g., 'abc' would not be.

varro
  • 2,382
  • 2
  • 16
  • 24