1

I'm using SQLite Manager Add-on, I couldn't find out the difference between these Data Types :

1) TEXT vs. TEXT (strict)

2) REAL vs. REAL (strict)

3) INTEGER vs. INTEGER (strict)

Barnabé
  • 11
  • 2

1 Answers1

4

SQLite uses dynamic typing, which means that it is possible to insert values of any type, regardless of the declared column type.

When you select a "strict" type, SQLite Manager will create an additional CHECK constraint to enforce the data type; something like this:

CREATE TABLE test (
    WithoutStrict INTEGER,
    WithStrict    INTEGER CHECK (typeof(WithStrict) = 'integer')
);

(This is not documented anywhere.)

CL.
  • 173,858
  • 17
  • 217
  • 259
  • That was very useful information, thank you. But I don't really understand, When would someone declare a column type, knowing that it is NOT strict? I mean when we declare a column type it MUST be strict , right? – Barnabé Mar 05 '14 at 06:58
  • Dynamic typing is a feature. If you actually want to use it, you don't want checks. Furthermore, the check added by SQLite Manager prevents NULL values. – CL. Mar 05 '14 at 08:13