HN2new | past | comments | ask | show | jobs | submitlogin

Have you tried using the CHECK constraint mechanism for this? https://www.sqlitetutorial.net/sqlite-check-constraint/


I am curious to know. Is there any reason why they don't support schema enforcement?


I'd love to know that too.

The FAQ says at https://sqlite.org/faq.html#q3 says "This is a feature, not a bug"

https://sqlite.org/datatype3.html says "the dynamic typing in SQLite allows it to do things which are not possible in traditional rigidly typed databases"... but it doesn't expand on that point at all.

My best guess is that this is a language culture thing. SQLite has a strong connection to the Tcl community - it started life as a Tcl extension: https://www.sqlite.org/tclsqlite.html - and Tcl is a very dynamically typed language.

Whatever the reasons, it's not going to change now: SQLite has extremely strong backwards-compatibility guarantees, and this is very much baked into how it works.

As a dynamic language person this has never bothered me in the slightest, but it's definitely something that comes up a lot from people who are put off using SQLite because of it.




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

Search: