#35156 closed Cleanup/optimization (fixed)
Update Doc comment about SQLite foreign keys
Reported by: | bcail | Owned by: | bcail |
---|---|---|---|
Component: | Documentation | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | bcail | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Multi-database docs say the following:
However, if you’re using SQLite or MySQL with MyISAM tables, there is no enforced referential integrity; as a result, you may be able to ‘fake’ cross database foreign keys.
But, foreign keys are enforced at the database level in SQLite, because the PRAGMA is turned on.
Should this comment be updated?
Change History (8)
follow-up: 2 comment:1 by , 10 months ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 10 months ago
Replying to Baptiste Mispelon:
1) Is the comment about MyISAM tables still correct then?
Yes, it is https://dev.mysql.com/doc/refman/8.3/en/ansi-diff-foreign-keys.html:
"For storage engines that do not support foreign keys (such as MyISAM),..."
comment:3 by , 10 months ago
2) Are there other places in the documentation that could be incorrect with regards to sqlite and FK constraints?
I just looked and didn't find any.
comment:6 by , 10 months ago
Triage Stage: | Accepted → Ready for checkin |
---|---|
Type: | Uncategorized → Cleanup/optimization |
Hi,
It seems you might be correct. The paragraph of documentation you linked to was introduced 14 years ago with #13316, whereas FK constraint were turned on in sqlite only 7 years ago with #14204 (I found that using the "blame" feature on github).
So we should fix this, but that leaves me with two questions:
1) Is the comment about MyISAM tables still correct then?
2) Are there other places in the documentation that could be incorrect with regards to sqlite and FK constraints?