3 ms·
> foreign keys are ignored by default This can be fixed in the connection string. > column types are not checked Now available, the STRICT keyword.
by euroderf 3y ago
> foreign keys are ignored by default
This can be fixed in the connection string.
> column types are not checked
Now available, the STRICT keyword.
- graemep 3y ago> This can be fixed in the connection string. Not a solid guarantee. More prone to bugs, errors, etc. What is someone changes something using the comnandline client and forgets to issue the pragma command? I would feel a lot happier using SQLite if this was a per DB setting rather than a per connection one.
- angra_mainyu 3y ago> Not a solid guarantee How so? Are you saying that sqlite would ignore the connection string?
- progmetaldev 3y agoAn older version that doesn't support the feature will probably just ignore the addition to the connection string.
- progmetaldev 3y agohttps://sqlite.org/foreignkeys.html#fk_enable https://sqlite.org/foreignkeys.html#fk_enable Judging by the documentation, if you issue a PRAGMA foreign_keys; and no row is returned containing a 0 or 1, then you are using an unsupported version of SQLite, or the library was compiled with foreign key support disabled. I am struggling to find any documentation that states if anything will occur if enabling foreign keys in the connection string, when the version does not support foreign keys.
- graemep 3y agoI mean it is too easy to get wrong through human error or buggy application code.
- rrdharan 3y agoCoercion isn’t necessarily what you want. See discussion here (when STRICT was introduced): https://news.ycombinator.com/item?id=28259104 https://news.ycombinator.com/item?id=28259104 It’s also only two years old which is forever in the web world and brand new by Databases ops/maturity standards. There are likely still warts waiting to be discovered (there always are, but the discovery rate tapers over decades).