Storage classes

Updated: April 19, 2023

Each value stored in a QDB database (or manipulated by the database engine) has one of the following storage classes:

NULL
A NULL value
INTEGER
A signed integer, stored in 1, 2, 3, 4, 6, or 8 bytes, depending on the magnitude of the value
REAL
A floating-point value, stored as an 8-byte IEEE floating-point number
TEXT
A text string, stored using the database encoding (UTF-8)
BLOB
A Binary Large OBject, stored exactly as it was input

Any database column with a type other than INTEGER PRIMARY KEY may be used to store any type of value. The exception to this rule is described in Other Affinity Modes as strict affinity mode.

All values supplied to QDB, whether as literals embedded in SQL statements or as values bound to precompiled SQL statements, are assigned a storage class before the query is executed. Under the circumstances described below, the database engine may convert values between numeric storage classes (INTEGER and REAL) and TEXT during query execution.

Storage classes are initially assigned as follows:

The storage class of a value that is the result of an SQL scalar operator depends on the outermost operator of the expression.