sqlite-type-affinity · shipping · also column affinity

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.

Related Observatory article: SQLite type affinity on hesela.com

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

related
SQLite STRICT table, SQLite integrity_check, SQLite Online Backup API

Citations

  1. SQLite: Datatypes, numeric affinity and storage classes (accessed 2026-10-20)
  2. Hesela: SQLite import precision experiment (accessed 2026-10-20)
Sources & caveats
  • Definition from SQLite documentation; observations from 75 designed insert attempts, not a population study.

JSON: /data/terms/sqlite-type-affinity.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. SQLite type affinity. Hesela. 2026-10-20. https://hesela.dev/terms/sqlite-type-affinity/