SQLite Forum

IS NULL optimization on NOT NULL constraints breaks on corrupted databases
Login
What do you expect to happen when **you** corrupt the database?


```
sqlite> pragma integrity_check;
┌───────────────────┐
│  integrity_check  │
├───────────────────┤
│ NULL value in t.v │
└───────────────────┘
```

The closest analogy is that **you** put an advertizement in the newspaper to sell your green car.  However, before the advertizement was printed, **you** painted the car blue.  However, the advertisement, when it appeared, was still tying to sell a green car.

**You** are not entitled to claim that the advertizement is now incorrect.

If **you** deliberately and with aforethought decide to make the database *inconsistent* and *incoherent*, and cannot be bothered to ensure the integrity of the database following you *coniptions*, they why would you place the blame for **your** failure on anyone else?

This reminds me of the old "Doctor, Doctor, in hurts when I do this" the patient complains as he pokes himself in the eye.  "Well do not do that then" replies the Doctor.

I believe the appropriate observation is that you been **"hoisted by your own petard"**.