3 ms·
But also FKs remain half-assed and seen with some disdain: it's 2023, support was added (a bit under) 14 years ago, and you still need to activate foreign keys
by masklinn 3y ago
But also FKs remain half-assed and seen with some disdain: it's 2023, support was added (a bit under) 14 years ago, and you still need to activate foreign keys every time you open the database file. There is still no way to enable FKs by default for a database file, let alone prevent disabling it.
- CodeHz 3y agono, you can do it by define SQLITE_DEFAULT_FOREIGN_KEYS=1 while compiling sqlite3
- hnarn 3y ago”You can set it before compiling” is such a foreign concept to the real world that it’s almost meaningless, if that is the only way to change the behavior it’s pretty crazy.
- arp242 3y agoMany applications use SQLite as an embedded library; that's how it's intended to be used anyway. It doesn't really jibe all that well with things like Python though, where you typically don't do that. But it's certainly not a "foreign concept" or "almost meaningless". For e.g. Python you can still just set the desired parameters when connecting, which should usually be handled by the database connector/driver for you.
- abtinf 3y agoI generally agree when it comes to standalone software, but not for libraries. SQLite is both. Setting a compiler flag is reasonable for the common case where it is included as a header file in a C/C++ application. It is certainly inconvenient when you design with that feature in mind, but can't rely on it being part of the standard binary distributions.