Menu

#1417 Suggestion about database export

3.5.7
open
nobody
Normal
2015-02-15
2013-04-03
Cyrano
No

Hi,
It is somthing not really usefull when the export includes views : filling view has is not appropriate, a view has already his own content each time is used. May be add a contion before writing filling code can solve this, if table.type != VIEW ?

I'd like to suggest an improvement on databases export : if i check to export user difined functions, they are writen at the end of the file. But if i have views using thoose functions, i'll have an error because the functions are not yet defined, then the affected views are not defined...

I undestand this can be a problem if views are used in functions... so, may be it could be usefull to be able to indicate a choice while i'm defining export parameters ?

Discussion

  • Marc Delisle

    Marc Delisle - 2013-04-03

    Ticket moved from /p/phpmyadmin/bugs/3866/

     
  • Maxime DAVID

    Maxime DAVID - 2014-03-25

    Hi,

    I've done a mockup of this feature, here is the preview
    (it's possible to reorder via drag and drop)

    If a item is not selected (for example FUNCTION) the item "FUNCTION" will disappear as well in the sortable list

     

    Last edit: Maxime DAVID 2014-03-25
  • Marc Delisle

    Marc Delisle - 2014-03-27

    Maxime,
    giving this choice to the user will make her wondering about what's the best order. Instead. can you (or Cyrano) propose what would be the best order, if there is an order that works all the time?

     
  • Maxime DAVID

    Maxime DAVID - 2014-03-27

    Unfortunately I don't think there is an order which will work all the time :

    For example :

    Procedures may use functions
    but
    Functions may use procedures

    Views may use functions
    but
    Functions may use views

    So there is not a predictable order which is going to work for sure

    Nevertheless, events and triggers can be exported at the end without risks and a algorithm can be developed to find the right order

    • for each view
    • if the current view is not using user-defined function -> export the view
    • it the current view is using user-defined function -> go to this function
      • if the function is using a view which is not already exported -> go to this view
      • if the function is using a function which is not already exported -> go to this function

    and so on

    I think the algorithm is a bit complicated but it's the only way (to my mind) to exports all procedures/functions/views in a right order

     
  • Marc Delisle

    Marc Delisle - 2014-04-01

    I have a suggestion to validate the order: try exporting all of these with mysqldump to see which order is generated, then try to import to see if mysqldump got it right. You will have to document the cases you are testing because this doc will have to go in the code when this is implemented.