0

The default foreign key contrain of MariaDB ON UPDATE and ON DELETE is RESTRICT.

However, in my schema, most foreign keys have ON UPDATE / ON DELETE set to CASCADE.

Although I appreciate the expliciting advertising of an occasional automatic deletation behavior, I find it annoying and slightly counter productive when the default behavior has to be explicitly typed for so many columns.

Is there an alternative to changing the default behavior per column, such as changing the default behavior of foreign keys ON UPDATE / ON DELETE constrains for an entire schema or table?

3
  • Bad idea. When asking for CASCADE, you need to stop and ask "is cascade really appropriate" for each FK usage.
    – Rick James
    Feb 28 '20 at 21:35
  • @RickJames Are you saying this is not implemented and this is the reason why? Or is this just your opinion?
    – user209974
    Feb 29 '20 at 19:21
  • Just my opinion. (I am not a fan of FKs -- there are too many cases in these forums where people are stumbling over their limitations.)
    – Rick James
    Feb 29 '20 at 23:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.