Git Product home page Git Product logo

Comments (1)

gocom avatar gocom commented on August 27, 2024

Actually disabling foreign_key_checks is also what the C-based mysqldump script (the one that ships with MySQL) does too. Looking at its source, its not able to do anything else than disable foreign key constraints.

Outside of disabling key constraints, the other and only option (that leads to somewhat might-break-at-any-second low-level code) is ordering all statements according to constraints, which I'm not sure if it's even fully possible (its for normal table references). This means that inserts, trigger/table/view/event creations and trigger/table/view/event drops will be all in mixed order. I'm not aware any project that actually even does this.

The only way of getting table constraint referencing order is by reading INFORMATION_SCHEMA.KEY_COLUMN_USAGE and writing a custom sorter handler that returns tables in constraint order. MySQL doesn't have its own extension for accessing key constraints (Danpu uses those documented SHOW extensions, which means simpler code and b/f compatibility, albeit if we wanted to support anything non-MySQL like we would have to access schema tables directly... and handle with vendor inconstancies).

As ordering goes, Danpu has same issues as the official mysqldump script. While both allow importing over existing databases, neither should if the database contains anything other than tables or views. Neither drops events/triggers before inserting rows, leading into duplicate data and/or error. Then again, it can be used as a feature.

We'll have to change the defaults for 3.0.0 release, and correct some of the logic for 2.7.0 (move trigger/event dropping to the top and add support for drop table -- as its new feature might as well change the create table if exits to drop-and-create as with tables/views/triggers/events -- offers some consistency too).

from danpu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.