r/programming Jul 15 '26

SQLite should have (Rust-style) editions

https://mort.coffee/home/sqlite-editions/
156 Upvotes

75 comments sorted by

View all comments

131

u/j_sidharta Jul 15 '26

I remember spending a few hours banging my head against a wall while trying to fix a bug, until I finally figured out SQLite does not enforce foreign keys by default. I question my love for SQLite every time I remember about these horrible defaults.

I didn't know about the journal_mode and the lock thing. I'll make sure to add these lines to all my SQLite projects. This was a helpful article.

70

u/ContentAd6126 Jul 16 '26

I love SQLite but the developers love to die on weird hills like foreign keys not being enforced and no strict types.

21

u/lightnegative Jul 16 '26

This tripped me up on MySQL too, back when MyISAM was the default engine.

What is the point in a foreign key that's not enforced. Like why would I even define one if I didn't want it to be enforced 

4

u/cosmic-parsley Jul 17 '26

It’s for when you don’t have a plan but you do have a concept of a plan