Hacker News new | past | comments | ask | show | jobs | submit login

They did add support for strict type checking fairly recently, and you can turn on foreign key checking I think.



Here is the STRICT table type page: https://www.sqlite.org/stricttables.html It is fairly straightforward: you just have to add STRICT to your table definition and you have it.

And the FOREIGN KEY support is here: https://www.sqlite.org/foreignkeys.html The two requirements are that your build not have it disabled, and that you execute `PRAGMA foreign_keys = ON;` when you open the database (every time you open the database).


I don't view opt-in as a very good defaults for these.


Then build with SQLITE_DEFAULT_FOREIGN_KEYS=1 to make it opt-out (and to opt-out you'd need to inject SQL).

As for STRICT: if you make your tables STRICT, there's no opt-out.

So why is this an issue? Do you want them to break the file format to say "from this version forward, all tables are STRICT"? What does that really buy you?

It's an embed database: anyone who can mess with your database and circumvert integrity can also open the file and corrupt it.


> What does that really buy you

It removes a footgun for new users. That's not an insignificant benefit.

Probably not worth the backwards compatibility cost, but it definitely is an issue.


My builds of SQLite do enable foreign keys by default.

This is easy to do for any project using the amalgamation.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: