SQLite VDBE opcode

RealAffinity

If register P1 holds an integer convert it to a real value.

An example

25 of the 178 statements we compiled against the sample database use RealAffinity. This is the one with the shortest program; the rows that use RealAffinity are highlighted.

SELECT typeof(price) FROM tracks
addropcodep1p2p3p4p5
0Init0900
1OpenRead04060
2Rewind0800
3Column0520
4RealAffinity2000
5Function021typeof(1)0
6ResultRow1100
7Next0301
8Halt0000
9Transaction00101
10Goto0100

Open it in the EXPLAIN visualizer →

Also in this program: Column, Function, Goto, Halt, Init, Next, OpenRead, ResultRow, Rewind, Transaction.

What the SQLite documentation says

If register P1 holds an integer convert it to a real value.

This opcode is used when extracting information from a column that has REAL affinity. Such column values may still be stored as integers, for space efficiency, but after extraction we want them to have only a real value.

From sqlite.org's list of opcodes for SQLite 3.54.1, in the public domain. Opcodes are not a stable interface and change between releases.

← Real · ReleaseReg →