Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#214 exporting dependent views

3.3.3
closed-accepted
Jakub Vrána
MySQL (66)
5
2013-04-29
2011-12-13
Anonymous
No

I have discovered a little problem in exporting dependent views with adminer. Example situation:

CREATE TABLE foo (bar INT);
CREARE VIEW afoo AS SELECT bar FROM foo;
CREATE VIEW aafoo AS SELECT bar FROM afoo;

when exporting this, if view aafoo is exported first, the result script does not work - it tries to create aafoo, but view afoo doest not exist yet.

My note:
I've found this bug because I'm using my own export script in my web app and face exactly the same problem;
The only solution I found is in phpmyadmin, which first creates tables of the same name and column types as exported views, then deletes each of them just before creating corresponding view.

Discussion

  • Jakub Vrána
    Jakub Vrána
    2012-12-16

    The problem is that there is no SQL parser in Adminer so it doesn't know which tables are used by views. Optimal solution would build a dependency graph and create tables in optimal order.

     
  • Jakub Vrána
    Jakub Vrána
    2013-04-27

    • status: open --> open-accepted
     
  • Jakub Vrána
    Jakub Vrána
    2013-04-27

    Actually, Adminer doesn't need to parse the query to create the temporary tables. It can just create temporary tables for all the views and then drop them just before creating the real ones.

     
  • Jakub Vrána
    Jakub Vrána
    2013-04-29

    Thank you for the report, I've fixed it in Git. You can download the "Current development version" from http://www.adminer.org/#download

     
  • Jakub Vrána
    Jakub Vrána
    2013-04-29

    • status: open-accepted --> closed-accepted