Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#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)

comment:1 by Baptiste Mispelon, 3 years ago

Triage Stage: Unreviewed → Accepted

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?

in reply to:  1 comment:2 by Mariusz Felisiak, 3 years 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 bcail, 3 years 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:4 by bcail, 3 years ago

Owner: changed from nobody to bcail
Status: new → assigned

I can open a PR.

comment:5 by bcail, 3 years ago

Has patch: set

comment:6 by Mariusz Felisiak, 3 years ago

Triage Stage: Accepted → Ready for checkin
Type: Uncategorized → Cleanup/optimization

comment:7 by Mariusz Felisiak <felisiak.mariusz@…>, 3 years ago

Resolution: → fixed
Status: assigned → closed

In b3dc8068:

Fixed #35156 -- Removed outdated note about not supporting foreign keys by SQLite.

comment:8 by Mariusz Felisiak <felisiak.mariusz@…>, 3 years ago

In d28c61b:

[5.0.x] Fixed #35156 -- Removed outdated note about not supporting foreign keys by SQLite.

Backport of b3dc80682e678b20c89fb2a430c0bc77960a29ac from main

Note: See TracTickets for help on using tickets.
Back to Top