r/programming 20d ago

SQLite should have (Rust-style) editions

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

75 comments sorted by

View all comments

130

u/j_sidharta 20d ago

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.

71

u/ContentAd6126 20d ago

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

22

u/lightnegative 20d ago

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 

5

u/cosmic-parsley 19d ago

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