Code

Opened 2 years ago

Closed 2 years ago

#17267 closed Cleanup/optimization (fixed)

MySQL Storage Engines: MyISAM doesn't support Foreign Keys

Reported by: anonymous Owned by: nobody
Component: Documentation Version: 1.2
Severity: Normal Keywords: database, mysql, 'storage engine', myisam, 'foreign key'
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description (last modified by aaugustin)

I was really wondering what this is supposed to mean. How can a Relational Database not support foreign keys?
So I had to go to to freenode#mysql to ask.

<Vacuity> or to be more precise, myisam doesn't support Foreign Key _Constraints_
<jay567> so I only have to check myself that the target of the FK is existant in the target table?
<Vacuity> jay567: it means, although you can define a myisam table with a CONSTRAINT FOREIGN KEY (col1) REFERENCES othertable (foocol) ON DELETE CASCADE ... , myisam will ignore this and will not enforce FK constraint
<Vacuity> jay567: yes, you will have to check that yourself
<Vacuity> jay567: if you don't have a very good reason to use myisam, you should use innodb anyways :)

so

  1. This shouldn't be an issue with Django, because it does not rely on the database for the above check, right?
  2. Could you please try to be more clear, so people like me don't need to wonder (see first two sentences)?

Attachments (0)

Change History (3)

comment:1 Changed 2 years ago by aaugustin

  • Description modified (diff)
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 2 years ago by aaugustin

  • Easy pickings set
  • Triage Stage changed from Unreviewed to Accepted
  1. No, Django does rely on the database for foreign key checks — that's its job!
  2. Yes, the wording could be clarified.

comment:3 Changed 2 years ago by aaugustin

  • Resolution set to fixed
  • Status changed from new to closed

In [17120]:

Fixed #17267 -- Clarified the description of MyISAM's lack of support for foreign keys.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.