SQLite type affinity
SQLite type affinity is a column's preference for a storage class, which can cause values to be converted when inserted or compared.
Numeric affinity can convert numeric-looking text to INTEGER or REAL. The declared column type and the actual storage class are separate properties. Preserve a source representation when its exact spelling or decimal value matters. [1]
In a controlled SQLite 3.45.1 matrix, text 9007199254740993.0 became integer 9007199254740992 in NUMERIC and STRICT INTEGER columns, while the digit-only string and exact integer binding preserved the intended integer. Completed backup and integrity checks retained the converted values. [2]
Relations
Citations
Sources & caveats
- Definition from SQLite documentation; observations from 75 designed insert attempts, not a population study.