From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "behavior" |
|---|
| subject | "Format:SQLite database file" |
|---|
| claim | "SQLite stores a value of a REAL-affinity column that has no fractional part with an integer serial type (1.0 as type 9, 2.0 as type 1, -0.0 as type 8, so the sign of negative zero is lost) and converts it back to a double when reading; a raw reader must apply the declared column affinity. Columns without affinity keep type 7." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "Format:SQLite database file" |
|---|
| observed_in | |
|---|
|
|---|
| data | | trigger | "INSERT/UPDATE of a floating-point value with an integral value into a column with REAL affinity" |
|---|
| effect | "record stores serial type 1-6, 8 or 9 instead of 7" |
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "applyAffinity: the integer representation is preferred even for REAL affinity; OP_MakeRecord marks such values MEM_IntReal" |
|---|
| repo | "https://github.com/sqlite/sqlite" |
|---|
| commit | "43a48f77585a88940c727f33682151418f544059" |
|---|
| path | "src/vdbe.c" |
|---|
| lines | "374-384, 3644-3649" |
|---|
|
| type | "runtime_test" |
|---|
| detail | "SQLite 3.53.1, CREATE TABLE r(x real, y): inserting 1.0, 2.0, -0.0, 1.5 into both columns gave serial types x = 9, 1, 8, 7 and y = 7, 7, 7, 7" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "REAL values stored as integers" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-17T19:34:48.812Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T06:02:47.481Z" |
|---|
| result | "confirmed" |
|---|
| method | "Read applyAffinity comment (vdbe.c 374-384: integer representation always preferred even for REAL affinity) and OP_MakeRecord lines 3635-3652 (MEM_IntReal marking) at sqlite 43a48f7. Note: applies to integral values within integer range; NUMERIC/INTEGER affinity do the same." |
|---|
|
|
|---|